I think no".
It is possible that the two trees are balanced in different ways, but have the same "order" of node values. For example, if from the set
1,2,3,4,5,6,7
You are building a tree:
4 2 6 1 3 5 7
in the order of passage will give 1,2,3,4,5,6,7.
however, if you select a different root node (if the list is not sorted correctly in advance)
5 4 6 2 7 1 3
These two trees will give the same traversal result in order, but (obviously) are not identical.
or even
7 6 5 4 3 2 1
et cetera.
This is also related to the issue with BSP trees (binary space), which are commonly used when detecting game development collisions and determining visibility.
BSP stores triangles in a tree. Each node contains a triangle or face. The left node contains all the children that are “behind”, and the right child contains everything that is “in front”. Reserve as expected.
If you select the leftmost facet in the scene as your root, the right child will own all the other faces. If you make a bad decision for the right child, the same thing will happen. It is entirely possible to create a BSP compiler that, through idiotic analysis, creates a “tree” that is actually a list (as in my last example above). The problem is to split the data set so that each node splits the remaining list as evenly as possible. This is one of the reasons that BSPs are usually generated at compile time, since building one for very complex geometry can take several hours to find the best solution.
source share