SlideShare a Scribd company logo
1 of 62
Download to read offline
Trees
www.tudorgirba.com
n5
n2
n6
n10
n1
n7
n4
n9
n3
n8
n5
n2
n6
n10
n1
n7
n4
n9
n3
n8
n5
n2
n6
n10
n1
n7
n4
n9
n3
n8
n5
n2
n6
n10
n1
n7
n4
n9
n3
n8
edge
node
n5
n2
n6
n10
n1
n7
n4
n9
n3
n8
leaf
root
n5
n2
n6
n10
n1
n7
n4
n9
n3
n8
parent
child
n5
n2
n6
n10
n1
n7
n4
n9
n3
n8
subtree
n5
n2
n6
n10
n1
n7
n4
n9
n3
n8
path
n5
n2
n6
n10
n1
n7
n4
n9
n3
n8
height = 1
depth = level = 2
degree = 1
n5
n2
n6
n10
n1
n7
n4
n9
n3
n8
height = 1
depth = level = 1
degree = 3
n5
n2
n6
n10
n1
n7
n4
n9
n3
n8
0
1
2
3
n5
n2
n6
n10
n1
n7
n4
n9
n3
n8
ordered tree
leftmost rightmost
n5
n2
n6
n10
n1
n7
n4
n9
n3
n8 n7
n4
n9n8
n1
n5
n4
n6
n3
n10
isomorphic trees
n4
n2
n5
n1
n6
n3
n7
left right
left leftright right
n4
n2
n5
n1
n3
n6 n4
n2
n5
n1
n6
n3
not a binary tree binary tree
n4
n2
n5
n1
n6
n3
n7
complete binary tree
breadth-first traversal
n4
n2
n5
n1
n6
n3
breadth-first traversal
n4
n2
n5
n1
n6
n3
1
breadth-first traversal
n4
n2
n5
n1
n6
n3
2
1
breadth-first traversal
n4
n2
n5
n1
n6
n3
2 3
1
breadth-first traversal
n4
n2
n5
n1
n6
n3
2 3
4
1
breadth-first traversal
n4
n2
n5
n1
n6
n3
2 3
4 5
1
breadth-first traversal
n4
n2
n5
n1
n6
n3
2 3
4 65
1
n4
n2
n5
n1
n6
n3
preorder(node)
visit(node).
preorder(node.left).
preorder(node.right).
n4
n2
n5
n1
n6
n3
1
preorder(node)
visit(node).
preorder(node.left).
preorder(node.right).
n4
n2
n5
n1
n6
n3
2
1
preorder(node)
visit(node).
preorder(node.left).
preorder(node.right).
n4
n2
n5
n1
n6
n3
2
3
1
preorder(node)
visit(node).
preorder(node.left).
preorder(node.right).
n4
n2
n5
n1
n6
n3
2
3 4
1
preorder(node)
visit(node).
preorder(node.left).
preorder(node.right).
n4
n2
n5
n1
n6
n3
2 5
3 4
1
preorder(node)
visit(node).
preorder(node.left).
preorder(node.right).
n4
n2
n5
n1
n6
n3
2 5
3 64
1
preorder(node)
visit(node).
preorder(node.left).
preorder(node.right).
n4
n2
n5
n1
n6
n3
inorder(node)
inorder(node.left).
visit(node).
inorder(node.right).
n4
n2
n5
n1
n6
n3
1
inorder(node)
inorder(node.left).
visit(node).
inorder(node.right).
n4
n2
n5
n1
n6
n3
2
1
inorder(node)
inorder(node.left).
visit(node).
inorder(node.right).
n4
n2
n5
n1
n6
n3
2
1 3
inorder(node)
inorder(node.left).
visit(node).
inorder(node.right).
n4
n2
n5
n1
n6
n3
2
1 3
4
inorder(node)
inorder(node.left).
visit(node).
inorder(node.right).
n4
n2
n5
n1
n6
n3
2
1 53
4
inorder(node)
inorder(node.left).
visit(node).
inorder(node.right).
n4
n2
n5
n1
n6
n3
2 6
1 53
4
inorder(node)
inorder(node.left).
visit(node).
inorder(node.right).
n4
n2
n5
n1
n6
n3
postorder (node)
postorder(node.left).
postorder(node.right).
visit(node).
n4
n2
n5
n1
n6
n3
1
postorder (node)
postorder(node.left).
postorder(node.right).
visit(node).
n4
n2
n5
n1
n6
n3
1 2
postorder (node)
postorder(node.left).
postorder(node.right).
visit(node).
n4
n2
n5
n1
n6
n3
3
1 2
postorder (node)
postorder(node.left).
postorder(node.right).
visit(node).
n4
n2
n5
n1
n6
n3
3
1 42
postorder (node)
postorder(node.left).
postorder(node.right).
visit(node).
n4
n2
n5
n1
n6
n3
3 5
1 42
postorder (node)
postorder(node.left).
postorder(node.right).
visit(node).
n4
n2
n5
n1
n6
n3
3 5
1 42
6
postorder (node)
postorder(node.left).
postorder(node.right).
visit(node).
!"#$%&'(")$*
!
"#$#%&'!&$()*+,%&)$!&-!.,--#/!)$!(*)+!0#$#*,%&)$!%)!
Example (group 15)
!"#$%&'(")$*
!
"#$#%&'!&$()*+,%&)$!&-!.,--#/!)$!(*)+!0#$#*,%&)$!%)!
Example (group 15)
Hierarchical structure
Binary search tree
n4
n2
n5
n1
n6
n3
2 6
1 53
4
n4 n2 n5 n1 n6 n3
2 61 53 4
n4 n2 n5 n1 n6 n3
2 61 53 4
n4
n2
n5
n1
n6
n3
2 6
1 53
4
n4
n2
n5
n1
n6
n3
2
6
1
5
3
4
Binary search tree
n4
n2
n5
n1
n6
n3
2 6
1 53
4
a + b - c * d
a + b - c * d
a
+
b
-
c
*
d
a
+
b
-
c
*
d
operator
operand
Infix notation
a
+
b
-
c
*
d
Postfix notation
Prefix notation
Infix notation
a
+
b
-
c
*
d
Postfix notation
Prefix notation -+ab*cd
Infix notation
a
+
b
-
c
*
d
a+b-c*d
Postfix notation
Prefix notation -+ab*cd
Infix notation
a
+
b
-
c
*
d
a+b-c*d
Postfix notation ab+cd*-
Prefix notation -+ab*cd
Tudor Gîrba
www.tudorgirba.com
creativecommons.org/licenses/by/3.0/

More Related Content

Viewers also liked

Problem solving strategies workshop
Problem solving strategies workshopProblem solving strategies workshop
Problem solving strategies workshop
kibbs
 
Design Thinking: The one thing that will transform the way you think
Design Thinking: The one thing that will transform the way you thinkDesign Thinking: The one thing that will transform the way you think
Design Thinking: The one thing that will transform the way you think
Digital Surgeons
 

Viewers also liked (10)

01 - Computational thinking
01 - Computational thinking01 - Computational thinking
01 - Computational thinking
 
Computational Thinking
Computational ThinkingComputational Thinking
Computational Thinking
 
Computational Thinking - A Revolution in 4 Steps
Computational Thinking - A Revolution in 4 StepsComputational Thinking - A Revolution in 4 Steps
Computational Thinking - A Revolution in 4 Steps
 
Problem solving strategies workshop
Problem solving strategies workshopProblem solving strategies workshop
Problem solving strategies workshop
 
Visual Design Thinking Workshop
Visual Design Thinking WorkshopVisual Design Thinking Workshop
Visual Design Thinking Workshop
 
Design Thinking: The one thing that will transform the way you think
Design Thinking: The one thing that will transform the way you thinkDesign Thinking: The one thing that will transform the way you think
Design Thinking: The one thing that will transform the way you think
 
IDEO's design thinking.
IDEO's design thinking. IDEO's design thinking.
IDEO's design thinking.
 
Intro to Design Thinking
Intro to Design ThinkingIntro to Design Thinking
Intro to Design Thinking
 
Introducing design thinking
Introducing design thinkingIntroducing design thinking
Introducing design thinking
 
The role of Design Thinking
The role of Design ThinkingThe role of Design Thinking
The role of Design Thinking
 

More from Tudor Girba

More from Tudor Girba (20)

Beyond software evolution: Software environmentalism
Beyond software evolution: Software environmentalismBeyond software evolution: Software environmentalism
Beyond software evolution: Software environmentalism
 
Software craftsmanship meetup (Zurich 2015) on solving real problems without ...
Software craftsmanship meetup (Zurich 2015) on solving real problems without ...Software craftsmanship meetup (Zurich 2015) on solving real problems without ...
Software craftsmanship meetup (Zurich 2015) on solving real problems without ...
 
GT Spotter
GT SpotterGT Spotter
GT Spotter
 
Don't demo facts. Demo stories! (handouts)
Don't demo facts. Demo stories! (handouts)Don't demo facts. Demo stories! (handouts)
Don't demo facts. Demo stories! (handouts)
 
Don't demo facts. Demo stories!
Don't demo facts. Demo stories!Don't demo facts. Demo stories!
Don't demo facts. Demo stories!
 
Humane assessment on cards
Humane assessment on cardsHumane assessment on cards
Humane assessment on cards
 
Underneath Scrum: Reflective Thinking
Underneath Scrum: Reflective ThinkingUnderneath Scrum: Reflective Thinking
Underneath Scrum: Reflective Thinking
 
1800+ TED talks later
1800+ TED talks later1800+ TED talks later
1800+ TED talks later
 
Software assessment by example (lecture at the University of Bern)
Software assessment by example (lecture at the University of Bern)Software assessment by example (lecture at the University of Bern)
Software assessment by example (lecture at the University of Bern)
 
Humane assessment: Taming the elephant from the development room
Humane assessment: Taming the elephant from the development roomHumane assessment: Taming the elephant from the development room
Humane assessment: Taming the elephant from the development room
 
Moose: how to solve real problems without reading code
Moose: how to solve real problems without reading codeMoose: how to solve real problems without reading code
Moose: how to solve real problems without reading code
 
Software Environmentalism (ECOOP 2014 Keynote)
Software Environmentalism (ECOOP 2014 Keynote)Software Environmentalism (ECOOP 2014 Keynote)
Software Environmentalism (ECOOP 2014 Keynote)
 
The emergent nature of software systems
The emergent nature of software systemsThe emergent nature of software systems
The emergent nature of software systems
 
Presenting is storytelling at Uni Zurich - slides (2014-03-05)
Presenting is storytelling at Uni Zurich - slides (2014-03-05)Presenting is storytelling at Uni Zurich - slides (2014-03-05)
Presenting is storytelling at Uni Zurich - slides (2014-03-05)
 
Presenting is storytelling at Uni Zurich - handouts (2014-03-05)
Presenting is storytelling at Uni Zurich - handouts (2014-03-05)Presenting is storytelling at Uni Zurich - handouts (2014-03-05)
Presenting is storytelling at Uni Zurich - handouts (2014-03-05)
 
Underneath Scrum: Reflective Thinking (talk at Scrum Breakfast Bern, 2013)
Underneath Scrum: Reflective Thinking (talk at Scrum Breakfast Bern, 2013)Underneath Scrum: Reflective Thinking (talk at Scrum Breakfast Bern, 2013)
Underneath Scrum: Reflective Thinking (talk at Scrum Breakfast Bern, 2013)
 
Demo-driven innovation teaser
Demo-driven innovation teaserDemo-driven innovation teaser
Demo-driven innovation teaser
 
Software assessment essentials (lecture at the University of Bern 2013)
Software assessment essentials (lecture at the University of Bern 2013)Software assessment essentials (lecture at the University of Bern 2013)
Software assessment essentials (lecture at the University of Bern 2013)
 
Demo-driven innovation (University of Zurich, June 2013)
Demo-driven innovation (University of Zurich, June 2013)Demo-driven innovation (University of Zurich, June 2013)
Demo-driven innovation (University of Zurich, June 2013)
 
Humane assessment with Moose at GOTO Aarhus 2011
Humane assessment with Moose at GOTO Aarhus 2011Humane assessment with Moose at GOTO Aarhus 2011
Humane assessment with Moose at GOTO Aarhus 2011
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
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
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
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
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
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
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
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 Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 

06 - Trees