0% found this document useful (0 votes)
84 views

Treaded Binary Tree

The document discusses threaded binary trees, which are a way to improve efficiency in binary trees. In a right threaded binary tree, NULL right child pointers are replaced with pointers to the in-order successor. This allows for efficient in-order traversal without recursive calls. Left threaded binary trees similarly replace NULL left child pointers with pointers to the in-order predecessor. A tree with both right and left threading is called a fully threaded binary tree. An example of a right threaded binary tree is shown with nodes A through J.

Uploaded by

Akif Vohra
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPS, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
84 views

Treaded Binary Tree

The document discusses threaded binary trees, which are a way to improve efficiency in binary trees. In a right threaded binary tree, NULL right child pointers are replaced with pointers to the in-order successor. This allows for efficient in-order traversal without recursive calls. Left threaded binary trees similarly replace NULL left child pointers with pointers to the in-order predecessor. A tree with both right and left threading is called a fully threaded binary tree. An example of a right threaded binary tree is shown with nodes A through J.

Uploaded by

Akif Vohra
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPS, PDF, TXT or read online on Scribd
You are on page 1/ 4

DATA

STRUCTURES

MAHESH GOYANI
MAHATMA GANDHI INSTITUE OF TECHNICAL EDUCATION & RESEARCH CENTER
[email protected]

(C) GOYANI MAHESH 1


THREADED
BINARY TREE

(C) GOYANI MAHESH 2


TERMINOLOGY

 Half of the entries in Left Child & Right Child field will contain NULL pointer. These fields
may be used more efficiently by replacing the NULL entries by special pointers which points to
the node higher in the tree.
 In a right threaded binary three each NULL right link is replaced by a special link to the
successor of that node under in-order traversal.
 Using right thread we shall find that it is easy to perform an in-order traversal of binary
three.

 In a Left Threaded Binary Three each NULL right link is replaced by a special link to the
predecessor of that node under in-order traversal.

 Tree with right and left thread, called fully threaded tree

(C) GOYANI MAHESH 3


Right Threaded Binary Tree

A Info LChild RChild


A[0] A 1 2
A[1] B 3 4
A[2] C 5
A[3] D 8
A[4] E 9 10

B C A[5] F 12
A[6]
A[7]
A[8] G -1
A[9] H -4
D E F
A[10] I -0
A[11]
A[12] J -2
A[13]
A[14]
G H I J

(C) GOYANI MAHESH 4

You might also like