Python DSALesson 98Free preview
Trees
This lesson is part of Python · All levels
Summary
This lesson introduces the tree, a non-linear data structure made up of nodes with parent-child relationships. Each tree has one root as its starting point and a node without a child is called a leaf. You'll also get to know some types of trees like binary trees, binary search trees, and balanced trees like AVL trees.
Key points
- The root is the top node, the leaf is the node without the child, and the edge is the link between the nodes.
- There's a unique path from the root to each node, so the tree should not contain cycles.
- The height of a tree is the number of edges from root to leaf.
- Trees can be searched by depth-first (preorder, inorder, postorder) or breadth-first (level-order).
- Tree structures are used in file systems, arithmetic expressions, and database indexes.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.