際際滷

際際滷Share a Scribd company logo
Presentation tree traversal
PRESENTED TO:
MAM AMNA
PRESENTED BY
Presentation tree traversal
Presentation tree traversal
Presentation tree traversal
Binary tree->binary tree is
defined as finite set of node
in which number of the
children of a node should not
exceed more than two .it
means the degree of binary
tree not then greater then
two.
BINARY TREE
A
B C
D E
F
G
TREE TRAVERSAL
TRAVERSAL REFERS TO THE
PROCESS OF VISITING
(EXAMINING AND/OR
UPDATING) EACH NODE IN
A TREE DATA STRUCTURE,
EXACTLY ONCE.
To traverse a non empty binary tree in in-
order following three operations are
performed
Traverse the left sub tree in in-order
Visit the root node
Traverse the right sub-tree in in-order
A
B C
D E
F
G
TRVERSE STARTS FROM THE ROOT NODESince D is the leaf node ,it gets printed ,which is
the left child of D.
D
Now B gets printed as it is the
parent of the node D
B
Since E is the leaf node ,it gets printed ,which is
right child of B
E
Now A gets printed as it is the parent of the
node B
A
Since F is the leaf node ,it gets printed
,which is the left child of c
F
Now C gets printed as it is the parent of
the node F
C
Since G is leaf node ,it gets printed ,which the
right child of C
G
IN ORDER TRAVERSAL
POST -ORDER TRAVERSALPrinting the data in post-order traversal
To traverse a non empty binary tree in
post-order following three operations are
performed
Traverse the left sub tree in post-order
Traverse the right sub-tree in post-
order
Visit the root node
A
B C
D
E F G
0
Now A gets printed as it is the parent of the
node B
Now C gets printed as it is the parent of the node
F
Since D is the leaf node ,it gets printed ,which is
the left child of D.
TRVERSE STARTS FROM THE ROOT NODENow B gets printed as it is the parent of
the node D
D E B
Now F gets printed as it is the left child of C
F G C A
Since E is the leaf node ,it gets printed
,which is right child of BNow G gets printed ,as it is the right child of C
a non empty binary tree in pre-order
following three operations are
performed To traverse
Visit the root node
Traverse the left sub tree in pre-
order
Traverse the right sub-tree in pre-
order
PRE-ORDER TRAVERSAL
A
B C
D E
F G
Printing the data in pre-order traversal
Traversal starts from the root node
The data at the root node i.e. A gets printed
A
Since D is the leaf node ,it gets printed ,which is
the left child of B.
D
Now B gets printed as it is the parent of the
node D
B
Since E is the leaf node ,it gets printed ,
which is right child of B
E
Now C gets printed as it is the parent of
the node F
C
Since F is the leaf node ,it gets printed ,
which is the left child of c
F
Since G is leaf node ,it gets printed ,
which the right child of C
G
Presentation tree traversal

More Related Content

Viewers also liked (18)

World Food Innovation- dream or nightmare? IDC-2016
World Food Innovation- dream or nightmare? IDC-2016World Food Innovation- dream or nightmare? IDC-2016
World Food Innovation- dream or nightmare? IDC-2016
Claire Cronier
Revista Digital Psicologia de la Personalidad II. Tema: "Trastornos de la per...Revista Digital Psicologia de la Personalidad II. Tema: "Trastornos de la per...
Revista Digital Psicologia de la Personalidad II. Tema: "Trastornos de la per...
Gisel Milagros Vaderna Martinez
computer notes - Traversal of a binary tree
computer notes - Traversal of a binary treecomputer notes - Traversal of a binary tree
computer notes - Traversal of a binary tree
ecomputernotes
Estatistica e Probabilidade - 5 Distribuic箕ao de FrequenciasEstatistica e Probabilidade - 5 Distribuic箕ao de Frequencias
Estatistica e Probabilidade - 5 Distribuic箕ao de Frequencias
Ranilson Paiva
Antioxidant enzymes and human health
Antioxidant enzymes and human healthAntioxidant enzymes and human health
Antioxidant enzymes and human health
Almustaqbal college University
仗亳仆亠亰舒舒 仆舒 亰仆仂 亞舒仂从
仗亳仆亠亰舒舒 仆舒 亰仆仂 亞舒仂从仗亳仆亠亰舒舒 仆舒 亰仆仂 亞舒仂从
仗亳仆亠亰舒舒 仆舒 亰仆仂 亞舒仂从
OU 11 Oktomvri
Tree in data structure
Tree in data structureTree in data structure
Tree in data structure
sh誰sh J辰誰n
Tree and Binary Search tree
Tree and Binary Search treeTree and Binary Search tree
Tree and Binary Search tree
Muhazzab Chouhadry
Tree Traversals (In-order, Pre-order and Post-order)
Tree Traversals (In-order, Pre-order and Post-order)Tree Traversals (In-order, Pre-order and Post-order)
Tree Traversals (In-order, Pre-order and Post-order)
raj upadhyay
Influence of foliar application of micronutrients on pulses
Influence of foliar application of micronutrients on pulsesInfluence of foliar application of micronutrients on pulses
Influence of foliar application of micronutrients on pulses
Vasantrao Nail Marathwada Krishi Vidyapeeth, Parbhani
6018 stk-paket a-akuntansi
6018 stk-paket a-akuntansi6018 stk-paket a-akuntansi
6018 stk-paket a-akuntansi
Agus Setiyawan
Disadvantages of file management system (file processing systems)
Disadvantages of file management system(file processing systems)Disadvantages of file management system(file processing systems)
Disadvantages of file management system (file processing systems)
raj upadhyay
Fake news presentation
Fake news presentationFake news presentation
Fake news presentation
Yumonomics
Binary Search Tree in Data Structure
Binary Search Tree in Data StructureBinary Search Tree in Data Structure
Binary Search Tree in Data Structure
Dharita Chokshi
Binary tree
Binary  treeBinary  tree
Binary tree
Vanitha Chandru
Introduction to Algorithms
Introduction to AlgorithmsIntroduction to Algorithms
Introduction to Algorithms
Venkatesh Iyer
Test de informatica basicaTest de informatica basica
Test de informatica basica
Chino Ramirez
World Food Innovation- dream or nightmare? IDC-2016
World Food Innovation- dream or nightmare? IDC-2016World Food Innovation- dream or nightmare? IDC-2016
World Food Innovation- dream or nightmare? IDC-2016
Claire Cronier
Revista Digital Psicologia de la Personalidad II. Tema: "Trastornos de la per...Revista Digital Psicologia de la Personalidad II. Tema: "Trastornos de la per...
Revista Digital Psicologia de la Personalidad II. Tema: "Trastornos de la per...
Gisel Milagros Vaderna Martinez
computer notes - Traversal of a binary tree
computer notes - Traversal of a binary treecomputer notes - Traversal of a binary tree
computer notes - Traversal of a binary tree
ecomputernotes
Estatistica e Probabilidade - 5 Distribuic箕ao de FrequenciasEstatistica e Probabilidade - 5 Distribuic箕ao de Frequencias
Estatistica e Probabilidade - 5 Distribuic箕ao de Frequencias
Ranilson Paiva
仗亳仆亠亰舒舒 仆舒 亰仆仂 亞舒仂从
仗亳仆亠亰舒舒 仆舒 亰仆仂 亞舒仂从仗亳仆亠亰舒舒 仆舒 亰仆仂 亞舒仂从
仗亳仆亠亰舒舒 仆舒 亰仆仂 亞舒仂从
OU 11 Oktomvri
Tree and Binary Search tree
Tree and Binary Search treeTree and Binary Search tree
Tree and Binary Search tree
Muhazzab Chouhadry
Tree Traversals (In-order, Pre-order and Post-order)
Tree Traversals (In-order, Pre-order and Post-order)Tree Traversals (In-order, Pre-order and Post-order)
Tree Traversals (In-order, Pre-order and Post-order)
raj upadhyay
6018 stk-paket a-akuntansi
6018 stk-paket a-akuntansi6018 stk-paket a-akuntansi
6018 stk-paket a-akuntansi
Agus Setiyawan
Disadvantages of file management system (file processing systems)
Disadvantages of file management system(file processing systems)Disadvantages of file management system(file processing systems)
Disadvantages of file management system (file processing systems)
raj upadhyay
Fake news presentation
Fake news presentationFake news presentation
Fake news presentation
Yumonomics
Binary Search Tree in Data Structure
Binary Search Tree in Data StructureBinary Search Tree in Data Structure
Binary Search Tree in Data Structure
Dharita Chokshi
Introduction to Algorithms
Introduction to AlgorithmsIntroduction to Algorithms
Introduction to Algorithms
Venkatesh Iyer
Test de informatica basicaTest de informatica basica
Test de informatica basica
Chino Ramirez

More from Ayesha Tahir (6)

STORAGE DEVICES & OPERATING SYSTEM SERVICES
STORAGE DEVICES & OPERATING SYSTEM SERVICESSTORAGE DEVICES & OPERATING SYSTEM SERVICES
STORAGE DEVICES & OPERATING SYSTEM SERVICES
Ayesha Tahir
OS , Its History and Types
OS , Its History and TypesOS , Its History and Types
OS , Its History and Types
Ayesha Tahir
MULTIPLEXERS
MULTIPLEXERSMULTIPLEXERS
MULTIPLEXERS
Ayesha Tahir
UDP and TCP Protocol & Encrytion and its algorithm
UDP and TCP Protocol & Encrytion and its algorithmUDP and TCP Protocol & Encrytion and its algorithm
UDP and TCP Protocol & Encrytion and its algorithm
Ayesha Tahir
Prims & kruskal algorithms
Prims & kruskal algorithmsPrims & kruskal algorithms
Prims & kruskal algorithms
Ayesha Tahir
Heap sort
Heap sortHeap sort
Heap sort
Ayesha Tahir
STORAGE DEVICES & OPERATING SYSTEM SERVICES
STORAGE DEVICES & OPERATING SYSTEM SERVICESSTORAGE DEVICES & OPERATING SYSTEM SERVICES
STORAGE DEVICES & OPERATING SYSTEM SERVICES
Ayesha Tahir
OS , Its History and Types
OS , Its History and TypesOS , Its History and Types
OS , Its History and Types
Ayesha Tahir
UDP and TCP Protocol & Encrytion and its algorithm
UDP and TCP Protocol & Encrytion and its algorithmUDP and TCP Protocol & Encrytion and its algorithm
UDP and TCP Protocol & Encrytion and its algorithm
Ayesha Tahir
Prims & kruskal algorithms
Prims & kruskal algorithmsPrims & kruskal algorithms
Prims & kruskal algorithms
Ayesha Tahir

Recently uploaded (20)

Recruiting Tech: A Look at Why AI is Actually OG
Recruiting Tech: A Look at Why AI is Actually OGRecruiting Tech: A Look at Why AI is Actually OG
Recruiting Tech: A Look at Why AI is Actually OG
Matt Charney
Getting the Best of TrueDEM April News & Updates
Getting the Best of TrueDEM  April News & UpdatesGetting the Best of TrueDEM  April News & Updates
Getting the Best of TrueDEM April News & Updates
panagenda
Top Tips to Get Your Data AI-Ready
Top Tips to Get Your Data AI-Ready   Top Tips to Get Your Data AI-Ready
Top Tips to Get Your Data AI-Ready
Precisely
A General introduction to Ad ranking algorithms
A General introduction to Ad ranking algorithmsA General introduction to Ad ranking algorithms
A General introduction to Ad ranking algorithms
Buhwan Jeong
Benefits of Moving Ellucian Banner to Oracle Cloud
Benefits of Moving Ellucian Banner to Oracle CloudBenefits of Moving Ellucian Banner to Oracle Cloud
Benefits of Moving Ellucian Banner to Oracle Cloud
AstuteBusiness
Sugarlab AI: How Much Does an XXX AI Porn Generator Cost in 2025
Sugarlab AI: How Much Does an XXX AI Porn Generator Cost in 2025Sugarlab AI: How Much Does an XXX AI Porn Generator Cost in 2025
Sugarlab AI: How Much Does an XXX AI Porn Generator Cost in 2025
Sugarlab AI
The effectiveness of ai powered educational tools in enhancing academic perfo...
The effectiveness of ai powered educational tools in enhancing academic perfo...The effectiveness of ai powered educational tools in enhancing academic perfo...
The effectiveness of ai powered educational tools in enhancing academic perfo...
aebhpmqaocxhydmajf
Next.js Development: The Ultimate Solution for High-Performance Web Apps
Next.js Development: The Ultimate Solution for High-Performance Web AppsNext.js Development: The Ultimate Solution for High-Performance Web Apps
Next.js Development: The Ultimate Solution for High-Performance Web Apps
rwinfotech31
Building High-Impact Teams Beyond the Product Triad.pdf
Building High-Impact Teams Beyond the Product Triad.pdfBuilding High-Impact Teams Beyond the Product Triad.pdf
Building High-Impact Teams Beyond the Product Triad.pdf
Rafael Burity
Smarter RAG Pipelines: Scaling Search with Milvus and Feast
Smarter RAG Pipelines: Scaling Search with Milvus and FeastSmarter RAG Pipelines: Scaling Search with Milvus and Feast
Smarter RAG Pipelines: Scaling Search with Milvus and Feast
Zilliz
Testing Tools for Accessibility Enhancement Part II.pptx
Testing Tools for Accessibility Enhancement Part II.pptxTesting Tools for Accessibility Enhancement Part II.pptx
Testing Tools for Accessibility Enhancement Part II.pptx
Julia Undeutsch
How Telemedicine App Development is Revolutionizing Virtual Care.pptx
How Telemedicine App Development is Revolutionizing Virtual Care.pptxHow Telemedicine App Development is Revolutionizing Virtual Care.pptx
How Telemedicine App Development is Revolutionizing Virtual Care.pptx
Dash Technologies Inc
Packaging your App for AppExchange Managed Vs Unmanaged.pptx
Packaging your App for AppExchange  Managed Vs Unmanaged.pptxPackaging your App for AppExchange  Managed Vs Unmanaged.pptx
Packaging your App for AppExchange Managed Vs Unmanaged.pptx
mohayyudin7826
Research Data Management (RDM): the management of dat in the research process
Research Data Management (RDM): the management of dat in the research processResearch Data Management (RDM): the management of dat in the research process
Research Data Management (RDM): the management of dat in the research process
HeilaPienaar
Scalable Multi-Agent AI with AutoGen by Udai
Scalable Multi-Agent AI with AutoGen by UdaiScalable Multi-Agent AI with AutoGen by Udai
Scalable Multi-Agent AI with AutoGen by Udai
Udaiappa Ramachandran
Commit Conf 2025 Bitnami Charts with Kubescape
Commit Conf 2025 Bitnami Charts with KubescapeCommit Conf 2025 Bitnami Charts with Kubescape
Commit Conf 2025 Bitnami Charts with Kubescape
Alfredo Garc鱈a Lavilla
AI in Talent Acquisition: Boosting Hiring
AI in Talent Acquisition: Boosting HiringAI in Talent Acquisition: Boosting Hiring
AI in Talent Acquisition: Boosting Hiring
Beyond Chiefs
Leadership Spectrum by Sonam Sherpa at GDG Kathmandu March Monthly Meetup
Leadership Spectrum by Sonam Sherpa at GDG Kathmandu March Monthly MeetupLeadership Spectrum by Sonam Sherpa at GDG Kathmandu March Monthly Meetup
Leadership Spectrum by Sonam Sherpa at GDG Kathmandu March Monthly Meetup
GDG Kathmandu
Automating Behavior-Driven Development: Boosting Productivity with Template-D...
Automating Behavior-Driven Development: Boosting Productivity with Template-D...Automating Behavior-Driven Development: Boosting Productivity with Template-D...
Automating Behavior-Driven Development: Boosting Productivity with Template-D...
DOCOMO Innovations, Inc.
Solana Developer Hiring for Enterprises Key Considerations.pdf
Solana Developer Hiring for Enterprises Key Considerations.pdfSolana Developer Hiring for Enterprises Key Considerations.pdf
Solana Developer Hiring for Enterprises Key Considerations.pdf
Lisa ward
Recruiting Tech: A Look at Why AI is Actually OG
Recruiting Tech: A Look at Why AI is Actually OGRecruiting Tech: A Look at Why AI is Actually OG
Recruiting Tech: A Look at Why AI is Actually OG
Matt Charney
Getting the Best of TrueDEM April News & Updates
Getting the Best of TrueDEM  April News & UpdatesGetting the Best of TrueDEM  April News & Updates
Getting the Best of TrueDEM April News & Updates
panagenda
Top Tips to Get Your Data AI-Ready
Top Tips to Get Your Data AI-Ready   Top Tips to Get Your Data AI-Ready
Top Tips to Get Your Data AI-Ready
Precisely
A General introduction to Ad ranking algorithms
A General introduction to Ad ranking algorithmsA General introduction to Ad ranking algorithms
A General introduction to Ad ranking algorithms
Buhwan Jeong
Benefits of Moving Ellucian Banner to Oracle Cloud
Benefits of Moving Ellucian Banner to Oracle CloudBenefits of Moving Ellucian Banner to Oracle Cloud
Benefits of Moving Ellucian Banner to Oracle Cloud
AstuteBusiness
Sugarlab AI: How Much Does an XXX AI Porn Generator Cost in 2025
Sugarlab AI: How Much Does an XXX AI Porn Generator Cost in 2025Sugarlab AI: How Much Does an XXX AI Porn Generator Cost in 2025
Sugarlab AI: How Much Does an XXX AI Porn Generator Cost in 2025
Sugarlab AI
The effectiveness of ai powered educational tools in enhancing academic perfo...
The effectiveness of ai powered educational tools in enhancing academic perfo...The effectiveness of ai powered educational tools in enhancing academic perfo...
The effectiveness of ai powered educational tools in enhancing academic perfo...
aebhpmqaocxhydmajf
Next.js Development: The Ultimate Solution for High-Performance Web Apps
Next.js Development: The Ultimate Solution for High-Performance Web AppsNext.js Development: The Ultimate Solution for High-Performance Web Apps
Next.js Development: The Ultimate Solution for High-Performance Web Apps
rwinfotech31
Building High-Impact Teams Beyond the Product Triad.pdf
Building High-Impact Teams Beyond the Product Triad.pdfBuilding High-Impact Teams Beyond the Product Triad.pdf
Building High-Impact Teams Beyond the Product Triad.pdf
Rafael Burity
Smarter RAG Pipelines: Scaling Search with Milvus and Feast
Smarter RAG Pipelines: Scaling Search with Milvus and FeastSmarter RAG Pipelines: Scaling Search with Milvus and Feast
Smarter RAG Pipelines: Scaling Search with Milvus and Feast
Zilliz
Testing Tools for Accessibility Enhancement Part II.pptx
Testing Tools for Accessibility Enhancement Part II.pptxTesting Tools for Accessibility Enhancement Part II.pptx
Testing Tools for Accessibility Enhancement Part II.pptx
Julia Undeutsch
How Telemedicine App Development is Revolutionizing Virtual Care.pptx
How Telemedicine App Development is Revolutionizing Virtual Care.pptxHow Telemedicine App Development is Revolutionizing Virtual Care.pptx
How Telemedicine App Development is Revolutionizing Virtual Care.pptx
Dash Technologies Inc
Packaging your App for AppExchange Managed Vs Unmanaged.pptx
Packaging your App for AppExchange  Managed Vs Unmanaged.pptxPackaging your App for AppExchange  Managed Vs Unmanaged.pptx
Packaging your App for AppExchange Managed Vs Unmanaged.pptx
mohayyudin7826
Research Data Management (RDM): the management of dat in the research process
Research Data Management (RDM): the management of dat in the research processResearch Data Management (RDM): the management of dat in the research process
Research Data Management (RDM): the management of dat in the research process
HeilaPienaar
Scalable Multi-Agent AI with AutoGen by Udai
Scalable Multi-Agent AI with AutoGen by UdaiScalable Multi-Agent AI with AutoGen by Udai
Scalable Multi-Agent AI with AutoGen by Udai
Udaiappa Ramachandran
Commit Conf 2025 Bitnami Charts with Kubescape
Commit Conf 2025 Bitnami Charts with KubescapeCommit Conf 2025 Bitnami Charts with Kubescape
Commit Conf 2025 Bitnami Charts with Kubescape
Alfredo Garc鱈a Lavilla
AI in Talent Acquisition: Boosting Hiring
AI in Talent Acquisition: Boosting HiringAI in Talent Acquisition: Boosting Hiring
AI in Talent Acquisition: Boosting Hiring
Beyond Chiefs
Leadership Spectrum by Sonam Sherpa at GDG Kathmandu March Monthly Meetup
Leadership Spectrum by Sonam Sherpa at GDG Kathmandu March Monthly MeetupLeadership Spectrum by Sonam Sherpa at GDG Kathmandu March Monthly Meetup
Leadership Spectrum by Sonam Sherpa at GDG Kathmandu March Monthly Meetup
GDG Kathmandu
Automating Behavior-Driven Development: Boosting Productivity with Template-D...
Automating Behavior-Driven Development: Boosting Productivity with Template-D...Automating Behavior-Driven Development: Boosting Productivity with Template-D...
Automating Behavior-Driven Development: Boosting Productivity with Template-D...
DOCOMO Innovations, Inc.
Solana Developer Hiring for Enterprises Key Considerations.pdf
Solana Developer Hiring for Enterprises Key Considerations.pdfSolana Developer Hiring for Enterprises Key Considerations.pdf
Solana Developer Hiring for Enterprises Key Considerations.pdf
Lisa ward

Presentation tree traversal

  • 7. Binary tree->binary tree is defined as finite set of node in which number of the children of a node should not exceed more than two .it means the degree of binary tree not then greater then two.
  • 9. TREE TRAVERSAL TRAVERSAL REFERS TO THE PROCESS OF VISITING (EXAMINING AND/OR UPDATING) EACH NODE IN A TREE DATA STRUCTURE, EXACTLY ONCE.
  • 10. To traverse a non empty binary tree in in- order following three operations are performed Traverse the left sub tree in in-order Visit the root node Traverse the right sub-tree in in-order A B C D E F G TRVERSE STARTS FROM THE ROOT NODESince D is the leaf node ,it gets printed ,which is the left child of D. D Now B gets printed as it is the parent of the node D B Since E is the leaf node ,it gets printed ,which is right child of B E Now A gets printed as it is the parent of the node B A Since F is the leaf node ,it gets printed ,which is the left child of c F Now C gets printed as it is the parent of the node F C Since G is leaf node ,it gets printed ,which the right child of C G IN ORDER TRAVERSAL
  • 11. POST -ORDER TRAVERSALPrinting the data in post-order traversal To traverse a non empty binary tree in post-order following three operations are performed Traverse the left sub tree in post-order Traverse the right sub-tree in post- order Visit the root node A B C D E F G 0 Now A gets printed as it is the parent of the node B Now C gets printed as it is the parent of the node F Since D is the leaf node ,it gets printed ,which is the left child of D. TRVERSE STARTS FROM THE ROOT NODENow B gets printed as it is the parent of the node D D E B Now F gets printed as it is the left child of C F G C A Since E is the leaf node ,it gets printed ,which is right child of BNow G gets printed ,as it is the right child of C
  • 12. a non empty binary tree in pre-order following three operations are performed To traverse Visit the root node Traverse the left sub tree in pre- order Traverse the right sub-tree in pre- order PRE-ORDER TRAVERSAL A B C D E F G Printing the data in pre-order traversal Traversal starts from the root node The data at the root node i.e. A gets printed A Since D is the leaf node ,it gets printed ,which is the left child of B. D Now B gets printed as it is the parent of the node D B Since E is the leaf node ,it gets printed , which is right child of B E Now C gets printed as it is the parent of the node F C Since F is the leaf node ,it gets printed , which is the left child of c F Since G is leaf node ,it gets printed , which the right child of C G