Search⌘ K
AI Features

Overview of Trees

Explore the structures and key properties of various tree types used in coding interviews. Understand binary trees, binary search trees, and advanced balanced trees like AVL, Red-Black, and 2-3 trees, focusing on their height, node count, and balancing rules.

Binary Trees

Definition: A tree where each vertex has two children at most.

Types: Perfect, Full, Complete, Skewed

Total number of nodes: 2(h+1)12^{(h+1)}-1

Total number of leaf nodes: 2hor(n+1)22^{h} or \frac{(n+1)}{2}

Height: log2(n+1)1log_{2}(n+1)-1 ...