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 Intro to Trees Chapter

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 Intro to Trees Chapter (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

New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
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
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 

Último (20)

New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
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
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 

Intro to Trees Chapter