Trees

Concept shape

Core
Definition

A binary tree is a tree where each node has at most two children.

Step 1 / 5
Concept shape
Current lesson

Binary Trees Lab

Trees Core

Binary Trees

Welcome to the Binary Trees concept lab. A binary tree is a tree where each node has at most two children. The must know points are: Left and right child are separate positions. Traversal order matters. Not every binary tree is a BST. The common operations are: preorder, inorder, postorder, level order. The complexity shape is Traversal O(n). Watch out for these pitfalls: Assuming left is always smaller. Forgetting empty tree cases. Related algorithms include Tree Traversals, DFS, BFS.

Concept details

A binary tree is a tree where each node has at most two children.

Must know

  • Left and right child are separate positions.
  • Traversal order matters.
  • Not every binary tree is a BST.

Complexity

Traversal O(n)

Open deeper visual structure lesson
1.0x