# Tree Data Structure Confidence: high Last verified: 2026-05-22 Generation: human_only ## TL;DR A tree is a hierarchical data structure with a root node and child subtrees. Each node (except root) has exactly one parent. Specialized trees: binary trees (max 2 children), N-ary trees, tries (prefix trees), segment trees (range queries), Fenwick trees (prefix sums). ## Core Explanation Binary tree properties: max nodes at level l = 2^l, max total nodes = 2^(h+1)-1. Full binary tree: every node has 0 or 2 children. Complete binary tree: all levels filled except possibly last. Perfect binary tree: all levels completely filled. Tries store strings character-by-character for O(k) lookup (k = key length). ## Further Reading - [Algorithms (4th Edition)](undefined)