Foundations
Linear Structures
Hashing
Array and String Patterns
Recursion, Search, and Sorting
Problem Solving Patterns
Algorithm Searching
Sorting Algorithms
Array Algorithms
Grid Algorithms
Linear Structure Algorithms
Hashing Algorithms
Recursion and Backtracking
Greedy Algorithms
Tree and Heap Algorithms
Graph Algorithms
Dynamic Programming Algorithms
String Algorithms
Math Algorithms
Keyboard ready
Space plays. Arrow keys step. R restarts.
LAB Trees Lab
Trees
Concept shape
Core
Definition
A tree is a hierarchical structure with nodes connected by parent-child relationships.
Step 1 / 5
Concept shape
Trees Core
Trees
Welcome to the Trees concept lab. A tree is a hierarchical structure with nodes connected by parent-child relationships. The must know points are: Root is the top node. Leaves have no children. Height affects many tree operation costs. The common operations are: traverse, search, insert, delete. The complexity shape is Traversal O(n), balanced search O(log n). Watch out for these pitfalls: Confusing height with node count. Forgetting null child cases. Related algorithms include Tree Traversals, BST Search.
Concept details
A tree is a hierarchical structure with nodes connected by parent-child relationships.
Must know
- Root is the top node.
- Leaves have no children.
- Height affects many tree operation costs.
Complexity
Traversal O(n), balanced search O(log n)
1.0x