0
How I can receive a data from an end leaf of a binaritree and after this to cancel this leaf. I agoing to change the data of a
I am going to change the data of a root with the data of the end leaf. And after this to sort the tree . So the data shouldn't to occur twice. I suppose to get the data of the root every time uniquely.
1 Answer
0
well a proper binary tree doesnt really have an "end" per say. it would have a lower limit and an upper limit as well as a root. when you input things into a binary tree, it tests to see if it higher lower than the root, if lower goes left, if higher goes right, this process repeats for any children that the root has, respectively with the way it goes.
if you wanted to remove any node in a binary tree you have to see how many chidren it has. then you can determine how to remove it. there are different removal algorithms for 0, 1 and 2 children.
there can never be any "repeats" in these trees as all of the information within the trees should be keys, unique integers.
--not sure what the question is here but this information should help, if you need to know how to dequeue the root, you can look up how to remove a node in a binary tree with two children. (assuming it has 2 children).
hope this helps!!