SlideShare a Scribd company logo
1 of 10
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

What's hot (20)

non linear data structure -introduction of tree
non linear data structure -introduction of treenon linear data structure -introduction of tree
non linear data structure -introduction of tree
 
Tree-In Data Structure
Tree-In Data StructureTree-In Data Structure
Tree-In Data Structure
 
Data structure tree - intermediate
Data structure tree - intermediateData structure tree - intermediate
Data structure tree - intermediate
 
Data Structure and Algorithms Binary Tree
Data Structure and Algorithms Binary TreeData Structure and Algorithms Binary Tree
Data Structure and Algorithms Binary Tree
 
Tree in data structure
Tree in data structureTree in data structure
Tree in data structure
 
Data structure tree- advance
Data structure tree- advanceData structure tree- advance
Data structure tree- advance
 
Dsc++ unit 3 notes
Dsc++ unit 3 notesDsc++ unit 3 notes
Dsc++ unit 3 notes
 
Chapter 8 ds
Chapter 8 dsChapter 8 ds
Chapter 8 ds
 
Data structure tree - beginner
Data structure tree - beginnerData structure tree - beginner
Data structure tree - beginner
 
(Binary tree)
(Binary tree)(Binary tree)
(Binary tree)
 
Binary tree and Binary search tree
Binary tree and Binary search treeBinary tree and Binary search tree
Binary tree and Binary search tree
 
Tree
TreeTree
Tree
 
Trees, Binary Search Tree, AVL Tree in Data Structures
Trees, Binary Search Tree, AVL Tree in Data Structures Trees, Binary Search Tree, AVL Tree in Data Structures
Trees, Binary Search Tree, AVL Tree in Data Structures
 
Lecture 6 tree traversal
Lecture 6 tree traversalLecture 6 tree traversal
Lecture 6 tree traversal
 
Trees - Data structures in C/Java
Trees - Data structures in C/JavaTrees - Data structures in C/Java
Trees - Data structures in C/Java
 
Tree and Binary Search tree
Tree and Binary Search treeTree and Binary Search tree
Tree and Binary Search tree
 
7.tree
7.tree7.tree
7.tree
 
Tree
TreeTree
Tree
 
Binary trees
Binary treesBinary trees
Binary trees
 
Trees in Data Structure
Trees in Data StructureTrees in Data Structure
Trees in Data Structure
 

Viewers also liked

Slideshare Engineering Graphics
Slideshare Engineering GraphicsSlideshare Engineering Graphics
Slideshare Engineering GraphicsSoham Kansodaria
 
Elements of Mechanical Engineering
Elements of Mechanical EngineeringElements of Mechanical Engineering
Elements of Mechanical EngineeringSoham Kansodaria
 
Research seminar lecture_2_research_proposal__types_of_research_methods_stude...
Research seminar lecture_2_research_proposal__types_of_research_methods_stude...Research seminar lecture_2_research_proposal__types_of_research_methods_stude...
Research seminar lecture_2_research_proposal__types_of_research_methods_stude...Daria Bogdanova
 
Binary Search Tree in Data Structure
Binary Search Tree in Data StructureBinary Search Tree in Data Structure
Binary Search Tree in Data StructureDharita Chokshi
 
5 pen pc technology ppt for seminor
5 pen pc technology ppt for seminor5 pen pc technology ppt for seminor
5 pen pc technology ppt for seminorpriyanka reddy
 
Sample Narrative report for seminars
Sample Narrative report for seminarsSample Narrative report for seminars
Sample Narrative report for seminarsNew Era University
 
DATA STRUCTURES
DATA STRUCTURESDATA STRUCTURES
DATA STRUCTURESbca2010
 

Viewers also liked (16)

Rfid
RfidRfid
Rfid
 
Dbms 4NF & 5NF
Dbms 4NF & 5NFDbms 4NF & 5NF
Dbms 4NF & 5NF
 
Slideshare Engineering Graphics
Slideshare Engineering GraphicsSlideshare Engineering Graphics
Slideshare Engineering Graphics
 
Enviornmental Studies
Enviornmental StudiesEnviornmental Studies
Enviornmental Studies
 
Data Warehouse
Data WarehouseData Warehouse
Data Warehouse
 
Elements of Mechanical Engineering
Elements of Mechanical EngineeringElements of Mechanical Engineering
Elements of Mechanical Engineering
 
Physics Dielectric
Physics DielectricPhysics Dielectric
Physics Dielectric
 
Tree in data structure
Tree in data structureTree in data structure
Tree in data structure
 
Tree - Data Structure
Tree - Data StructureTree - Data Structure
Tree - Data Structure
 
B tree
B treeB tree
B tree
 
Research seminar lecture_2_research_proposal__types_of_research_methods_stude...
Research seminar lecture_2_research_proposal__types_of_research_methods_stude...Research seminar lecture_2_research_proposal__types_of_research_methods_stude...
Research seminar lecture_2_research_proposal__types_of_research_methods_stude...
 
Binary Search Tree in Data Structure
Binary Search Tree in Data StructureBinary Search Tree in Data Structure
Binary Search Tree in Data Structure
 
5 pen pc technology ppt for seminor
5 pen pc technology ppt for seminor5 pen pc technology ppt for seminor
5 pen pc technology ppt for seminor
 
Spillway
Spillway Spillway
Spillway
 
Sample Narrative report for seminars
Sample Narrative report for seminarsSample Narrative report for seminars
Sample Narrative report for seminars
 
DATA STRUCTURES
DATA STRUCTURESDATA STRUCTURES
DATA STRUCTURES
 

Similar to Full threded binary tree

Similar to Full threded binary tree (20)

NON-LINEAR DATA STRUCTURE-TREES.pptx
NON-LINEAR DATA STRUCTURE-TREES.pptxNON-LINEAR DATA STRUCTURE-TREES.pptx
NON-LINEAR DATA STRUCTURE-TREES.pptx
 
Data Structures 4
Data Structures 4Data Structures 4
Data Structures 4
 
Binary tree and operations
Binary tree and operations Binary tree and operations
Binary tree and operations
 
UNIT-4 TREES.ppt
UNIT-4 TREES.pptUNIT-4 TREES.ppt
UNIT-4 TREES.ppt
 
Tree
TreeTree
Tree
 
Threaded Binary Tree.pptx
Threaded Binary Tree.pptxThreaded Binary Tree.pptx
Threaded Binary Tree.pptx
 
Trees
TreesTrees
Trees
 
cppggggggggggggggggggggggggggggggggggggggg.pptx
cppggggggggggggggggggggggggggggggggggggggg.pptxcppggggggggggggggggggggggggggggggggggggggg.pptx
cppggggggggggggggggggggggggggggggggggggggg.pptx
 
Lecture 21_Trees - I.pptx
Lecture 21_Trees - I.pptxLecture 21_Trees - I.pptx
Lecture 21_Trees - I.pptx
 
358 33 powerpoint-slides_10-trees_chapter-10
358 33 powerpoint-slides_10-trees_chapter-10358 33 powerpoint-slides_10-trees_chapter-10
358 33 powerpoint-slides_10-trees_chapter-10
 
Unit 5 Tree.pptx
Unit 5 Tree.pptxUnit 5 Tree.pptx
Unit 5 Tree.pptx
 
AD3251-Data Structures Design-Notes-Tree.pdf
AD3251-Data Structures  Design-Notes-Tree.pdfAD3251-Data Structures  Design-Notes-Tree.pdf
AD3251-Data Structures Design-Notes-Tree.pdf
 
Binary Tree and jsksjshddjdjdkdkdjdjdjfjckck
Binary Tree and jsksjshddjdjdkdkdjdjdjfjckckBinary Tree and jsksjshddjdjdkdkdjdjdjfjckck
Binary Tree and jsksjshddjdjdkdkdjdjdjfjckck
 
Unit 4.1 (tree)
Unit 4.1 (tree)Unit 4.1 (tree)
Unit 4.1 (tree)
 
Balance tree. Short overview
Balance tree. Short overviewBalance tree. Short overview
Balance tree. Short overview
 
Lecture 5 tree.pptx
Lecture 5 tree.pptxLecture 5 tree.pptx
Lecture 5 tree.pptx
 
Lecture 8 data structures and algorithms
Lecture 8 data structures and algorithmsLecture 8 data structures and algorithms
Lecture 8 data structures and algorithms
 
Tree
TreeTree
Tree
 
Trees in data structures
Trees in data structuresTrees in data structures
Trees in data structures
 
BINARY SEARCH TREE
BINARY SEARCH TREEBINARY SEARCH TREE
BINARY SEARCH TREE
 

Recently uploaded

Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)simmis5
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...ranjana rawat
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 

Recently uploaded (20)

Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 

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