Trees

Concept shape

Core
Definition

A tree is a hierarchical structure with nodes connected by parent-child relationships.

Step 1 / 5
Concept shape
Current lesson

Trees Lab

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)

Open deeper visual structure lesson
1.0x