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

Threaded Binary Tree

Threaded binary trees make inorder traversal faster by modifying null child pointers to instead point to the next node in inorder sequence, avoiding the need for recursion or an explicit stack. There are two types: single threaded uses only right pointers, while double threaded uses both left and right pointers to connect both predecessors and successors, allowing reverse and postorder traversals. Threads also enable quick access to ancestor nodes.

Uploaded by

Sutanu MUKHERJEE
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
106 views

Threaded Binary Tree

Threaded binary trees make inorder traversal faster by modifying null child pointers to instead point to the next node in inorder sequence, avoiding the need for recursion or an explicit stack. There are two types: single threaded uses only right pointers, while double threaded uses both left and right pointers to connect both predecessors and successors, allowing reverse and postorder traversals. Threads also enable quick access to ancestor nodes.

Uploaded by

Sutanu MUKHERJEE
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Threaded Binary Tree

The idea of threaded binary trees is to make inorder traversal faster and do it without
stack and without recursion. A binary tree is made threaded by making all right child
pointers that would normally be NULL point to the inorder successor of the node (if it
exists).
There are two types of threaded binary trees. 
Single Threaded: Where a NULL right pointers is made to point to the inorder successor
(if successor exists)
Double Threaded: Where both left and right NULL pointers are made to point to inorder
predecessor and inorder successor respectively. The predecessor threads are useful for
reverse inorder traversal and postorder traversal.
The threads are also useful for fast accessing ancestors of a node.
Following diagram shows an example Single Threaded Binary Tree. The dotted lines
represent threads. 

You might also like