SlideShare a Scribd company logo
2
Most read
3
Most read
SUBJECT – DS
TOPIC – THREADED BINARY TREE
Dec 16, 2016
1
 It’s one type of binary tree.
 The wasted NULL links in the binary tree storage representation can
be replaced by threads.
 A binary tree is threaded according to particular traversal order. e.g.:
Threads for the inorder traversals of tree are pointers to its higher
nodes, for this traversal order.
 If left link of node P is null, then this link is replaced by the address of
its predecessor.
 If right link of node P is null, then it is replaced by the address of its
successor
 Because the left or right link of a node can denote either structural
link or a thread, we must somehow be able to distinguish them.
 Method 1:- Represent thread a –ve address.
 Method 2:- To have a separate Boolean flag for each of left and
right pointers, node structure for this is given below,
What is Threaded Binary Tree?What is Threaded Binary Tree?
LPTR LTHREAD Data RTHREAD RPTR
Alternate node for threaded binary tree
•LTHREAD = true = Denotes leaf thread link
•LTHREAD = false = Denotes leaf structural link
•RTHREAD = true = Denotes right threaded link
•RTHREAD = false = Denotes right structural link
•Head node is simply another node which serves as the predecessor and successor
of first and last tree nodes. Tree is attached to the left branch of the head node
Head
Advantages
Inorder traversal is faster than unthreaded version as
stack is not required.
Effectively determines the predecessor and successor
for inorder traversal, for unthreaded tree this task is
more difficult.
A stack is required to provide upward pointing
information in tree which threading provides.
It is possible to generate successor or predecessor of
any node without having over head of stack with the
help of threading.
Disadvantages
Threaded trees are unable to share common
subtrees.
If –ve addressing is not permitted in programming
language, two additional fields are required.
Insertion into and deletion from threaded binary
tree are more time consuming because both thread
and structural link must be maintained.
Binary Tree
Example 1
Inorder Traversal C B A E F D G
Fully In-threaded binary tree of given binary tree
HEAD
A
C E
F
DB
G
Example 2
Binary Tree
Right In-threaded binary tree of given binary tree
HEAD
A
B
C F
G
D
E
H
Dec 16, 2016
10

More Related Content

PDF
Threaded binarytree&heapsort
PPTX
Threaded Binary Tree
PPTX
Threaded binary tree
PPTX
THREADED BINARY TREE AND BINARY SEARCH TREE
PPT
Trees - Non Linear Data Structure
PPTX
Binary Tree Traversal
PPSX
Data Structure (Tree)
PPTX
Types of Tree in Data Structure in C++
Threaded binarytree&heapsort
Threaded Binary Tree
Threaded binary tree
THREADED BINARY TREE AND BINARY SEARCH TREE
Trees - Non Linear Data Structure
Binary Tree Traversal
Data Structure (Tree)
Types of Tree in Data Structure in C++

What's hot (20)

PPTX
non linear data structure -introduction of tree
PPT
Tree-In Data Structure
PPTX
Data structure tree - intermediate
PPT
Data Structure and Algorithms Binary Tree
PPTX
Tree in data structure
PPTX
Data structure tree- advance
PDF
Dsc++ unit 3 notes
PPT
Chapter 8 ds
PPTX
Data structure tree - beginner
PPT
(Binary tree)
PPTX
Binary tree and Binary search tree
PPTX
PDF
Trees, Binary Search Tree, AVL Tree in Data Structures
PPTX
Lecture 6 tree traversal
PPT
Trees - Data structures in C/Java
PPT
Tree and Binary Search tree
PPTX
PPT
PPT
Binary trees
PPTX
Trees in Data Structure
non linear data structure -introduction of tree
Tree-In Data Structure
Data structure tree - intermediate
Data Structure and Algorithms Binary Tree
Tree in data structure
Data structure tree- advance
Dsc++ unit 3 notes
Chapter 8 ds
Data structure tree - beginner
(Binary tree)
Binary tree and Binary search tree
Trees, Binary Search Tree, AVL Tree in Data Structures
Lecture 6 tree traversal
Trees - Data structures in C/Java
Tree and Binary Search tree
Binary trees
Trees in Data Structure
Ad

Viewers also liked (16)

PPTX
Dbms 4NF & 5NF
PPT
Slideshare Engineering Graphics
PPT
Enviornmental Studies
PPT
Data Warehouse
PPT
Elements of Mechanical Engineering
PPT
Physics Dielectric
PPTX
Tree in data structure
PPTX
Tree - Data Structure
PPTX
B tree
PDF
Research seminar lecture_2_research_proposal__types_of_research_methods_stude...
PPTX
Binary Search Tree in Data Structure
PPTX
5 pen pc technology ppt for seminor
PPT
Spillway
DOC
Sample Narrative report for seminars
PPT
DATA STRUCTURES
Dbms 4NF & 5NF
Slideshare Engineering Graphics
Enviornmental Studies
Data Warehouse
Elements of Mechanical Engineering
Physics Dielectric
Tree in data structure
Tree - Data Structure
B tree
Research seminar lecture_2_research_proposal__types_of_research_methods_stude...
Binary Search Tree in Data Structure
5 pen pc technology ppt for seminor
Spillway
Sample Narrative report for seminars
DATA STRUCTURES
Ad

Similar to Full threded binary tree (20)

PPTX
Threaded Binary Tree.pptx
PPTX
Threaded Binary Tree.pptx
PPT
Binary search Tree and avl tree , treee.ppt
PPTX
Unit 3 - Part 1_Threaded Binary Tree.pptx
PPT
BINARY SEARCH TREE
PPTX
Tree structure and its definitions with an example
DOCX
Chapter 4
PPT
Chap 5 Tree.ppt
PDF
Binary Trees, Traversals and BST.pdf....
PPTX
BCS304 Module 3 Slide 29-61.pptx DSA notes 3rd sem
PPT
9. TREE Data Structure Non Linear Data Structure
PPTX
Unit 3 dsuc
PPTX
cppggggggggggggggggggggggggggggggggggggggg.pptx
PPTX
PPTX
NON-LINEAR DATA STRUCTURE-TREES.pptx
PPTX
UNIT III Non Linear Data Structures - Trees.pptx
PPTX
DS-UNIT-4zjufrusefihfacbciauhfbaiuhc.pptx
PPT
PPT
Data Structure And Algorithms for Computer Science
Threaded Binary Tree.pptx
Threaded Binary Tree.pptx
Binary search Tree and avl tree , treee.ppt
Unit 3 - Part 1_Threaded Binary Tree.pptx
BINARY SEARCH TREE
Tree structure and its definitions with an example
Chapter 4
Chap 5 Tree.ppt
Binary Trees, Traversals and BST.pdf....
BCS304 Module 3 Slide 29-61.pptx DSA notes 3rd sem
9. TREE Data Structure Non Linear Data Structure
Unit 3 dsuc
cppggggggggggggggggggggggggggggggggggggggg.pptx
NON-LINEAR DATA STRUCTURE-TREES.pptx
UNIT III Non Linear Data Structures - Trees.pptx
DS-UNIT-4zjufrusefihfacbciauhfbaiuhc.pptx
Data Structure And Algorithms for Computer Science

Recently uploaded (20)

PPTX
Welding lecture in detail for understanding
PPTX
Construction Project Organization Group 2.pptx
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPTX
Lecture Notes Electrical Wiring System Components
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PPTX
CH1 Production IntroductoryConcepts.pptx
PPTX
web development for engineering and engineering
PPTX
OOP with Java - Java Introduction (Basics)
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
additive manufacturing of ss316l using mig welding
PDF
Digital Logic Computer Design lecture notes
PPT
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
Welding lecture in detail for understanding
Construction Project Organization Group 2.pptx
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
Lecture Notes Electrical Wiring System Components
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
CH1 Production IntroductoryConcepts.pptx
web development for engineering and engineering
OOP with Java - Java Introduction (Basics)
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
R24 SURVEYING LAB MANUAL for civil enggi
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
additive manufacturing of ss316l using mig welding
Digital Logic Computer Design lecture notes
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
UNIT-1 - COAL BASED THERMAL POWER PLANTS
CYBER-CRIMES AND SECURITY A guide to understanding

Full threded binary tree

  • 1. SUBJECT – DS TOPIC – THREADED BINARY TREE Dec 16, 2016 1
  • 2.  It’s one type of binary tree.  The wasted NULL links in the binary tree storage representation can be replaced by threads.  A binary tree is threaded according to particular traversal order. e.g.: Threads for the inorder traversals of tree are pointers to its higher nodes, for this traversal order.  If left link of node P is null, then this link is replaced by the address of its predecessor.  If right link of node P is null, then it is replaced by the address of its successor  Because the left or right link of a node can denote either structural link or a thread, we must somehow be able to distinguish them.  Method 1:- Represent thread a –ve address.  Method 2:- To have a separate Boolean flag for each of left and right pointers, node structure for this is given below, What is Threaded Binary Tree?What is Threaded Binary Tree?
  • 3. LPTR LTHREAD Data RTHREAD RPTR Alternate node for threaded binary tree •LTHREAD = true = Denotes leaf thread link •LTHREAD = false = Denotes leaf structural link •RTHREAD = true = Denotes right threaded link •RTHREAD = false = Denotes right structural link •Head node is simply another node which serves as the predecessor and successor of first and last tree nodes. Tree is attached to the left branch of the head node Head
  • 4. Advantages Inorder traversal is faster than unthreaded version as stack is not required. Effectively determines the predecessor and successor for inorder traversal, for unthreaded tree this task is more difficult. A stack is required to provide upward pointing information in tree which threading provides. It is possible to generate successor or predecessor of any node without having over head of stack with the help of threading.
  • 5. Disadvantages Threaded trees are unable to share common subtrees. If –ve addressing is not permitted in programming language, two additional fields are required. Insertion into and deletion from threaded binary tree are more time consuming because both thread and structural link must be maintained.
  • 7. Inorder Traversal C B A E F D G Fully In-threaded binary tree of given binary tree HEAD A C E F DB G
  • 9. Right In-threaded binary tree of given binary tree HEAD A B C F G D E H