SlideShare a Scribd company logo
1 of 13
PRESENTED TO:
MA’M AMNA
PRESENTED BY
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

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-2016Claire 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...
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 treeecomputernotes
 
Estatística e Probabilidade - 5 Distribuição de Frequências
Estatística e Probabilidade - 5 Distribuição de FrequênciasEstatística e Probabilidade - 5 Distribuição de Frequências
Estatística e Probabilidade - 5 Distribuição de FrequênciasRanilson Paiva
 
принцезата на зрно грашок
принцезата на зрно грашокпринцезата на зрно грашок
принцезата на зрно грашокOU 11 Oktomvri
 
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-akuntansiAgus 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 presentationYumonomics
 
Binary Search Tree in Data Structure
Binary Search Tree in Data StructureBinary Search Tree in Data Structure
Binary Search Tree in Data StructureDharita Chokshi
 
Introduction to Algorithms
Introduction to AlgorithmsIntroduction to Algorithms
Introduction to AlgorithmsVenkatesh Iyer
 
Test de informatica basica
Test de informatica basicaTest de informatica basica
Test de informatica basicaChino Ramirez
 

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
 
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...
Revista Digital Psicologia de la Personalidad II. Tema: "Trastornos de la per...
 
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
 
Estatística e Probabilidade - 5 Distribuição de Frequências
Estatística e Probabilidade - 5 Distribuição de FrequênciasEstatística e Probabilidade - 5 Distribuição de Frequências
Estatística e Probabilidade - 5 Distribuição de Frequências
 
Antioxidant enzymes and human health
Antioxidant enzymes and human healthAntioxidant enzymes and human health
Antioxidant enzymes and human health
 
karya ilmiah populer
karya ilmiah populerkarya ilmiah populer
karya ilmiah populer
 
принцезата на зрно грашок
принцезата на зрно грашокпринцезата на зрно грашок
принцезата на зрно грашок
 
Tree in data structure
Tree in data structureTree in data structure
Tree in data structure
 
Tree and Binary Search tree
Tree and Binary Search treeTree and Binary Search tree
Tree and Binary Search tree
 
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)
 
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
 
6018 stk-paket a-akuntansi
6018 stk-paket a-akuntansi6018 stk-paket a-akuntansi
6018 stk-paket a-akuntansi
 
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)
 
Fake news presentation
Fake news presentationFake news presentation
Fake news presentation
 
Binary Search Tree in Data Structure
Binary Search Tree in Data StructureBinary Search Tree in Data Structure
Binary Search Tree in Data Structure
 
Binary tree
Binary  treeBinary  tree
Binary tree
 
Introduction to Algorithms
Introduction to AlgorithmsIntroduction to Algorithms
Introduction to Algorithms
 
Test de informatica basica
Test de informatica basicaTest de informatica basica
Test de informatica basica
 

More from Ayesha Tahir

STORAGE DEVICES & OPERATING SYSTEM SERVICES
STORAGE DEVICES & OPERATING SYSTEM SERVICESSTORAGE DEVICES & OPERATING SYSTEM SERVICES
STORAGE DEVICES & OPERATING SYSTEM SERVICESAyesha Tahir
 
OS , Its History and Types
OS , Its History and TypesOS , Its History and Types
OS , Its History and TypesAyesha 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 algorithmAyesha Tahir
 
Prims & kruskal algorithms
Prims & kruskal algorithmsPrims & kruskal algorithms
Prims & kruskal algorithmsAyesha Tahir
 

More from Ayesha Tahir (6)

STORAGE DEVICES & OPERATING SYSTEM SERVICES
STORAGE DEVICES & OPERATING SYSTEM SERVICESSTORAGE DEVICES & OPERATING SYSTEM SERVICES
STORAGE DEVICES & OPERATING SYSTEM SERVICES
 
OS , Its History and Types
OS , Its History and TypesOS , Its History and Types
OS , Its History and Types
 
MULTIPLEXERS
MULTIPLEXERSMULTIPLEXERS
MULTIPLEXERS
 
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
 
Prims & kruskal algorithms
Prims & kruskal algorithmsPrims & kruskal algorithms
Prims & kruskal algorithms
 
Heap sort
Heap sortHeap sort
Heap sort
 

Recently uploaded

Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 

Recently uploaded (20)

Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 

Presentation tree traversal

  • 1.
  • 4.
  • 5.
  • 6.
  • 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