E
E
ewb2014-11-15 17:08:17
Data Structures
ewb, 2014-11-15 17:08:17

What is the name of the data structure with the parent-child relationship?

Hello!
For example, there is a table in the database in which the relationship of elements in the form of parent-child is implemented, what is the name of such a data structure in itself? Apart from the table?
67eba58a956947438fc455556b5db892.png
I'm assuming this is a tree? Which tree exactly?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
P
Power, 2014-11-15
@ewb

In general, this is a directed graph. But most likely, you specifically have this tree, just a tree.

S
Sergey Lerg, 2014-11-15
@Lerg

In relation to the database it is called "one-to-many", and in programming this can be expressed, for example, as an associative array, where each element of the array with the parent key is a regular array containing all page. If there is more than one level, then nested associative arrays are obtained, where each child element in the associative array can also become an associative array.
But it cannot be called a "tree" data structure. Trees are more complex and usually include efficient search and traversal algorithms. Such a tree will be called an N-Tree, in which each element can have up to N branches.
In relation to websites, the page structure for the code is usually loaded into a complex array, and not into a tree.

E
ewb, 2014-11-16
@ewb

Gentlemen, thanks for the replies! But they did not bring clarity.
Not exactly a tree, a graph, a tree, an associative array.
Is such a structure essentially vague or does everyone have their own opinion?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question