Learn Trees
Learn the tree data structure using Python and create an adventure game!
StartKey Concepts
Review core concepts you need to learn to master this subject
Wide and deep trees
Binary search tree
Nodes as parents
Trees are composed of nodes
Tree nodes children
Python TreeNode class
Wide and deep trees
Wide and deep trees
There are two ways to describe the shape of a tree. Trees can be wide, meaning that each node has many children. And trees can be deep, meaning that there are many parent-child connections with few siblings per node. Trees can be both wide and deep at the same time.
Trees: Conceptual
Lesson 1 of 2
- 1Trees are an essential data structure for storing hierarchical data with a directed flow. Similar to linked lists and graphs, trees are composed of nodes which hold data. The diagram represents …
- 2Trees grow downwards in computer science, and a root node is at the very top. The root of this tree is /photos. /photos references to two other nodes: /safari and /wedding. /safari and /wedding …
- 3Trees come in various shapes and sizes depending on the dataset modeled. Some are wide, with parent nodes referencing many child nodes. Some are deep, with many parent-child relationships. Tre…
- 4Constraints are placed on the data or node arrangement of a tree to solve difficult problems like efficient search. A binary tree is a type of tree where each parent can have **no more than tw…
- 5Trees are useful for modeling data that has a hierarchical relationship which moves in the direction from parent to child. No child node will have more than one parent. To recap some terms: * ro…
What you'll create
Portfolio projects that showcase your new skills
How you'll master it
Stress-test your knowledge with quizzes that help commit syntax to memory