Problems
Terminology¶
- What is a root node?
- What is the difference between depth, height, and level?
- What is a:
- Ancestor
- Sibiling
- Child
- Parent
- What are internal nodes? Leaf nodes?
Traversals¶
¶
- What distinguishes each traversal type (preorder, inorder, postorder) from each other?
- Write the order in which the nodes are visited when performing the following traversals:
- Preorder
- Inorder
- Postorder
Tree Types¶
¶
- Is the tree above full, complete, or perfect?
- If needed, how would you modify the tree so it will become only:
- Full
- Complete
- Perfect
Tree Type Definitions¶
Type | Definition |
---|---|
Full | Every node contains 0 or 2 children |
Complete | All levels, except possibly the last level, are completely full and all nodes in the last level are as far left as possible |
Perfect | All internal nodes have 2 children and all leaf nodes are at the same level |