34 BST insert Easy Recursive Descent

Add a new value to a binary search tree so that the BST property is preserved.

O(h) time · O(h) space
35 BST search Easy Recursive Descent

Look up whether a value exists in a binary search tree.

O(h) time · O(1) space (iterative)
36 Height of a binary tree Easy Recursive Max

Find how many levels deep a binary tree goes from root to its deepest leaf.

O(n) time · O(h) space
37 Inorder traversal Easy L -> Visit -> R

Visit every node in a binary tree in left-root-right order (gives sorted order for BSTs).

O(n) time · O(h) space
38 Preorder traversal Easy Visit -> L -> R

Visit every node in a binary tree in root-left-right order.

O(n) time · O(h) space
39 Level-order traversal (BFS) Medium Queue by Level

Visit every node in a binary tree level by level, from top to bottom.

O(n) time · O(n) space
40 Validate BST Medium Min/Max Bounds

Check whether a binary tree satisfies the BST rule (left < root < right) at every node.

O(n) time · O(h) space
139 Diameter of Binary Tree Easy Post-order Height

Find the longest path between any two nodes in a binary tree, counted in edges.

O(n) time · O(h) space (recursion depth)
140 Binary Tree Right Side View Medium Level-order BFS

Imagine looking at a binary tree from the right side. List what you'd see from top to bottom.

O(n) time · O(n) space
141 Count Good Nodes in Binary Tree Medium DFS with Max

Count nodes where no ancestor on the path from the root has a larger value.

O(n) time · O(h) space (recursion depth)