0% found this document useful (0 votes)
25 views2 pages

Threaded Binary Tree (TBT)

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views2 pages

Threaded Binary Tree (TBT)

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Threaded Binary Tree (TBT)

In a Threaded Binary Tree, the empty (NULL) left or right pointers in a binary tree are used to
point to the in-order predecessor or successor. This helps in faster in-order traversal without
using recursion or a stack.

Why use it?

In a normal binary tree, many pointers are NULL. We use these NULLs to store extra info
(threads) to make traversal easier.

Types:

Single Threaded – only left or right is threaded.

Double Threaded – both left and right are threaded.

Example:

For this tree:

4
/\
2 5
/\
1 3

In-order: 1 → 2 → 3 → 4 → 5

In a threaded tree:

Node 1's right points to 2 (its next node).

Node 3's right points to 4.

Node 5's right is NULL (no thread needed).

Benefits:
Saves memory

Faster traversal (no stack or recursion)

You might also like