Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Confusion with Threaded binary tree

enter image description here

Hi all,

As per definition of Threaded binary tree given below

A binary tree is threaded by making all right child pointers that would normally be null point to the inorder successor of the node, and all left child pointers that would normally be null point to the inorder predecessor of the node.

But in above diagram right child pointers pointing to inorder predecessor and left child pointer pointing to inorder successor ,that making me confuse.

like image 870
Amit Singh Tomar Avatar asked Jan 19 '26 20:01

Amit Singh Tomar


1 Answers

Look at C, what is it's predecessor? Successor? The order is

B then C then D

So B is C's predecessor, D is C successor.

Where does C's left pointer point? B, that's the predecessor, seems good to me.

Likewise, as expected, C's right pointer points to D.

Seems like statement, diagram and logic all agree. Where's the problem?

like image 135
djna Avatar answered Jan 21 '26 10:01

djna



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!