I did not mean the binary search tree.
for example, if I paste the values ββ1,2,3,4,5 into a binary search tree, then going around in order will give 1,2,3,4,5 as an output.
but if I insert the same values ββinto a binary tree, then going around in order should give 4,2,5,1,3 as an output.
The binary tree can be created using dynamic arrays in which for each element of the index n, 2n + 1 and 2n + 2 are their left and right child elements, respectively.
therefore, introducing and circumventing the level order here is very easy.
But I think the order is in order, pre-order is difficult.
My question is how can we create a binary tree, such as a binary search tree. i.e. have a tree class that contains data, left and right pointers instead of arrays. so that we can recursively traverse.
c # data-structures binary-tree
Tom
source share