Answer the question
In order to leave comments, you need to log in
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?
I'm assuming this is a tree? Which tree exactly?
Answer the question
In order to leave comments, you need to log in
In general, this is a directed graph. But most likely, you specifically have this tree, just a tree.
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.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question