G
G
GreySS2016-09-09 20:19:38
C++ / C#
GreySS, 2016-09-09 20:19:38

Dynamic data structure. What is it?

In the requirements for one vacancy (junior) Dynamic data structure.
Quote from Prat S., page 189: "The tool for this, again, is the new operator. With it, you can create dynamic structures. Dynamic here again means allocating memory at run time, not at
compile time. By the way, since classes very similar to structs, you will be able to use the techniques learned for both structs and classes.". This is clear. Yandex also displays a lot of tasks / examples where dsd is applied to the Stack. As a result, we get structures and a stack. What else can be attributed to dsd?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Stanislav Makarov, 2016-09-09
@Nipheris

dynamic structures. Dynamic here again means allocating memory at run time, not at compile time.

Anything that falls under the definition above. Any tree, queue, deque, etc. that implements dynamic memory allocation. You need to understand that this is more about the implementation of a data structure in a programming language than it is about the data structure itself.
You draw conclusions like a person with logic, but absolutely no knowledge of the subject. You have put in one row completely incomparable things. Maybe you should study the material in depth first?

M
Mercury13, 2016-09-09
@Mercury13

The tool for this, again, is the new operator.

This is the DSD criterion. Everything that uses dynamic memory is a dynamic data structure.
Why only?
Organized: single object, array, different kinds of trees, linked list and combinations of all of these…
Semantics: single object, indexed array, associative array, list, stack, queue, pimpl (implementation pointer), dynamic string…
For example, associative an array (semantics) can be implemented as a search tree (binary tree), or as a hash table (expandable dynamic array + bunch of linked lists).
The queue (semantics) can be a circular list (dynamic array, possibly expandable), it can be an expandable array of dynamic arrays (this is how std::deque from C++ works), it can be a linked list.
The standard approach to a string is a dynamic array. But what if we, for example, glue and glue something to the end of the line? Or write a text editor where you can enter text in the middle? Also tricky structures.
The task of Yandex is to check the subject in a few minutes. It is unlikely that you will gnaw a difficult task during this time. That's why they love simple data structures.

A
abcd0x00, 2016-09-10
@abcd0x00

A dynamic data structure is a data structure whose number of elements can change during a process. This concept has nothing to do with dynamic memory and new.
Stack, queue, deque, sequence, set, loaded set, L1 list, L2 list, dynamic vector, tree, hash table and others are all dynamic data structures.
But just a vector, a matrix - these are non-dynamic data structures, because the number of elements in them is fixed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question