SlideShare uma empresa Scribd logo
1 de 44
Chapter 6

Introduction to Trees
Objectives
Upon completion you will be able to:
• Understand and use basic tree terminology and concepts
• Recognize and define the basic attributes of a binary tree
• Process trees using depth-first and breadth-first traversals
• Parse expressions using a binary tree
• Design and implement Huffman trees
• Understand the basic use and processing of general trees
Data Structures: A Pseudocode Approach with C

1
6-1 Basic Tree Concepts
We begin the Chapter with a discussion of the terminology used
with trees. Once the terminology is understood, we discuss three
user-oriented tree representations: general trees, indented parts
lists, and parenthetical trees.

• Terminology
• User Representation

Data Structures: A Pseudocode Approach with C

2
Data Structures: A Pseudocode Approach with C

3
Data Structures: A Pseudocode Approach with C

4
Data Structures: A Pseudocode Approach with C

5
Data Structures: A Pseudocode Approach with C

6
Data Structures: A Pseudocode Approach with C

7
Data Structures: A Pseudocode Approach with C

8
6-2 Binary Trees
A binary tree can have no more than two descendents. In this
section we discuss the properties of binary trees, four different
binary tree traversals, and two applications, expression trees and
Huffman Code.

• Properties
• Binary Tree Traversals
• Expression Trees
• Huffman Code

Data Structures: A Pseudocode Approach with C

9
Data Structures: A Pseudocode Approach with C

10
Data Structures: A Pseudocode Approach with C

11
Data Structures: A Pseudocode Approach with C

12
Data Structures: A Pseudocode Approach with C

13
Data Structures: A Pseudocode Approach with C

14
Data Structures: A Pseudocode Approach with C

15
Data Structures: A Pseudocode Approach with C

16
Data Structures: A Pseudocode Approach with C

17
Data Structures: A Pseudocode Approach with C

18
Data Structures: A Pseudocode Approach with C

19
Data Structures: A Pseudocode Approach with C

20
Data Structures: A Pseudocode Approach with C

21
Data Structures: A Pseudocode Approach with C

22
Data Structures: A Pseudocode Approach with C

23
Data Structures: A Pseudocode Approach with C

24
Data Structures: A Pseudocode Approach with C

25
Data Structures: A Pseudocode Approach with C

26
Data Structures: A Pseudocode Approach with C

27
Data Structures: A Pseudocode Approach with C

28
Data Structures: A Pseudocode Approach with C

29
Data Structures: A Pseudocode Approach with C

30
Data Structures: A Pseudocode Approach with C

31
Data Structures: A Pseudocode Approach with C

32
Data Structures: A Pseudocode Approach with C

33
Data Structures: A Pseudocode Approach with C

34
6-3 General Trees
A general tree can have an unlimited number of descendents. We
discuss three topics in this section: general tree insertions,
deletions, and converting a general tree to a binary tree.

• Insertions into General Trees
• General Tree Deletions
• Changing a General Tree to a Binary Tree

Data Structures: A Pseudocode Approach with C

35
Data Structures: A Pseudocode Approach with C

36
Data Structures: A Pseudocode Approach with C

37
Data Structures: A Pseudocode Approach with C

38
Data Structures: A Pseudocode Approach with C

39
Data Structures: A Pseudocode Approach with C

40
Data Structures: A Pseudocode Approach with C

41
Data Structures: A Pseudocode Approach with C

42
Data Structures: A Pseudocode Approach with C

43
Data Structures: A Pseudocode Approach with C

44

Mais conteúdo relacionado

Semelhante a Introduction to trees

Basic concepts
Basic conceptsBasic concepts
Basic conceptsHuma Ayub
 
B.Tech 2nd Year CSE & CSIT AICTE Model Curriculum 2019-20.pdf
B.Tech 2nd Year CSE & CSIT AICTE Model Curriculum 2019-20.pdfB.Tech 2nd Year CSE & CSIT AICTE Model Curriculum 2019-20.pdf
B.Tech 2nd Year CSE & CSIT AICTE Model Curriculum 2019-20.pdfAnita Pal
 
SE-IT DSA THEORY SYLLABUS
SE-IT DSA THEORY SYLLABUSSE-IT DSA THEORY SYLLABUS
SE-IT DSA THEORY SYLLABUSnikshaikh786
 
Concepts, use cases and principles to build big data systems (1)
Concepts, use cases and principles to build big data systems (1)Concepts, use cases and principles to build big data systems (1)
Concepts, use cases and principles to build big data systems (1)Trieu Nguyen
 
Data Structures and Algorithm - Week 4 - Trees, Binary Trees
Data Structures and Algorithm - Week 4 - Trees, Binary TreesData Structures and Algorithm - Week 4 - Trees, Binary Trees
Data Structures and Algorithm - Week 4 - Trees, Binary TreesFerdin Joe John Joseph PhD
 
Acc 564 quiz 4 – strayer new
Acc 564 quiz 4 – strayer newAcc 564 quiz 4 – strayer new
Acc 564 quiz 4 – strayer newninfaames
 
computer system architecture
computer system architecturecomputer system architecture
computer system architecturedileesh E D
 
Chapter – 1 Intro to DBS.pdf
Chapter – 1 Intro to DBS.pdfChapter – 1 Intro to DBS.pdf
Chapter – 1 Intro to DBS.pdfTamiratDejene1
 
Chapter – 1 Intro to DBS.pdf
Chapter – 1 Intro to DBS.pdfChapter – 1 Intro to DBS.pdf
Chapter – 1 Intro to DBS.pdfTamiratDejene1
 
ICT_PracticeWorks[1].pdf
ICT_PracticeWorks[1].pdfICT_PracticeWorks[1].pdf
ICT_PracticeWorks[1].pdfssuserade1a1
 
cprogramming questions for practice end term
cprogramming questions for practice end termcprogramming questions for practice end term
cprogramming questions for practice end termSheelendra3
 
ESWC 2011 BLOOMS+
ESWC 2011 BLOOMS+ ESWC 2011 BLOOMS+
ESWC 2011 BLOOMS+ Prateek Jain
 
Knowledge graphs for knowing more and knowing for sure
Knowledge graphs for knowing more and knowing for sureKnowledge graphs for knowing more and knowing for sure
Knowledge graphs for knowing more and knowing for sureSteffen Staab
 
big data presentation to upload.pptx
big data presentation to upload.pptxbig data presentation to upload.pptx
big data presentation to upload.pptxAlkalimatayiba
 
Jumpstart: Introduction to Schema Design
Jumpstart: Introduction to Schema DesignJumpstart: Introduction to Schema Design
Jumpstart: Introduction to Schema DesignMongoDB
 
Graph Data Modeling Best Practices(Eric_Monk).pptx
Graph Data Modeling Best Practices(Eric_Monk).pptxGraph Data Modeling Best Practices(Eric_Monk).pptx
Graph Data Modeling Best Practices(Eric_Monk).pptxNeo4j
 

Semelhante a Introduction to trees (20)

Basic concepts
Basic conceptsBasic concepts
Basic concepts
 
Basic.ppt
Basic.pptBasic.ppt
Basic.ppt
 
B.Tech 2nd Year CSE & CSIT AICTE Model Curriculum 2019-20.pdf
B.Tech 2nd Year CSE & CSIT AICTE Model Curriculum 2019-20.pdfB.Tech 2nd Year CSE & CSIT AICTE Model Curriculum 2019-20.pdf
B.Tech 2nd Year CSE & CSIT AICTE Model Curriculum 2019-20.pdf
 
SE-IT DSA THEORY SYLLABUS
SE-IT DSA THEORY SYLLABUSSE-IT DSA THEORY SYLLABUS
SE-IT DSA THEORY SYLLABUS
 
Concepts, use cases and principles to build big data systems (1)
Concepts, use cases and principles to build big data systems (1)Concepts, use cases and principles to build big data systems (1)
Concepts, use cases and principles to build big data systems (1)
 
Data Structures and Algorithm - Week 4 - Trees, Binary Trees
Data Structures and Algorithm - Week 4 - Trees, Binary TreesData Structures and Algorithm - Week 4 - Trees, Binary Trees
Data Structures and Algorithm - Week 4 - Trees, Binary Trees
 
Acc 564 quiz 4 – strayer new
Acc 564 quiz 4 – strayer newAcc 564 quiz 4 – strayer new
Acc 564 quiz 4 – strayer new
 
computer system architecture
computer system architecturecomputer system architecture
computer system architecture
 
Chapter – 1 Intro to DBS.pdf
Chapter – 1 Intro to DBS.pdfChapter – 1 Intro to DBS.pdf
Chapter – 1 Intro to DBS.pdf
 
Chapter – 1 Intro to DBS.pdf
Chapter – 1 Intro to DBS.pdfChapter – 1 Intro to DBS.pdf
Chapter – 1 Intro to DBS.pdf
 
ICT_PracticeWorks[1].pdf
ICT_PracticeWorks[1].pdfICT_PracticeWorks[1].pdf
ICT_PracticeWorks[1].pdf
 
cprogramming questions for practice end term
cprogramming questions for practice end termcprogramming questions for practice end term
cprogramming questions for practice end term
 
ESWC 2011 BLOOMS+
ESWC 2011 BLOOMS+ ESWC 2011 BLOOMS+
ESWC 2011 BLOOMS+
 
Conclusions: Summary and Outlook
Conclusions: Summary and OutlookConclusions: Summary and Outlook
Conclusions: Summary and Outlook
 
Knowledge graphs for knowing more and knowing for sure
Knowledge graphs for knowing more and knowing for sureKnowledge graphs for knowing more and knowing for sure
Knowledge graphs for knowing more and knowing for sure
 
Week 1
Week 1Week 1
Week 1
 
big data presentation to upload.pptx
big data presentation to upload.pptxbig data presentation to upload.pptx
big data presentation to upload.pptx
 
Dbms
DbmsDbms
Dbms
 
Jumpstart: Introduction to Schema Design
Jumpstart: Introduction to Schema DesignJumpstart: Introduction to Schema Design
Jumpstart: Introduction to Schema Design
 
Graph Data Modeling Best Practices(Eric_Monk).pptx
Graph Data Modeling Best Practices(Eric_Monk).pptxGraph Data Modeling Best Practices(Eric_Monk).pptx
Graph Data Modeling Best Practices(Eric_Monk).pptx
 

Mais de priya_trehan

Mais de priya_trehan (14)

Security Mechanisms
Security MechanismsSecurity Mechanisms
Security Mechanisms
 
Wordpress
WordpressWordpress
Wordpress
 
Types of E commerce & Payment Models
Types of E commerce & Payment ModelsTypes of E commerce & Payment Models
Types of E commerce & Payment Models
 
Friction as a necessary evil
Friction as a necessary evilFriction as a necessary evil
Friction as a necessary evil
 
File handling
File handlingFile handling
File handling
 
Datapreprocessing
DatapreprocessingDatapreprocessing
Datapreprocessing
 
Johari window
Johari windowJohari window
Johari window
 
Input output
Input outputInput output
Input output
 
Silent sound technology
Silent sound technologySilent sound technology
Silent sound technology
 
Packages
PackagesPackages
Packages
 
Protocols
ProtocolsProtocols
Protocols
 
Kiosk
KioskKiosk
Kiosk
 
Photoshop
PhotoshopPhotoshop
Photoshop
 
Art of listening
Art of listeningArt of listening
Art of listening
 

Último

Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 

Último (20)

Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 

Introduction to trees