Introduction
Here is the code for a threaded binary tree.
The basic difference between a binary tree and the threaded binary tree is that in the binary trees the nodes are null if there is no child associated with it and so there is no way to traverse back.
But in a threaded binary tree we have threads associated with the nodes i.e they either are linked to the predecessor or successor in the inorder traversal of the nodes. This helps us to traverse further or backward in the inorder traversal fashion.
There can be two types of threaded binary tree :-
1) Single Threaded :- i.e nodes are threaded either towards its inorder predecessor or successor.
2) Double threaded:- i.e nodes are threaded towards both the inorder predecessor and successor.
The code below is for double threaded binary tree.
Adsense
Subscribe to:
Post Comments (Atom)

0 comments:
Post a Comment