Tree Data Structures
Complete reference of tree data structures: binary trees, BST, AVL, Red-Black, B-trees, B+ trees, segment trees, and trie.
Complete reference of tree data structures: binary trees, BST, AVL, Red-Black, B-trees, B+ trees, segment trees, and trie.
| Name | Type | Properties | Use cases | Notes |
|---|---|---|---|---|
| Binary Tree | Base Structure |
|
| Simplest tree form; all other binary trees are specialized variants |
| Binary Search Tree (BST) | Search Structure |
|
| Degenerates to linked list if insert order sorted; balancing needed for guaranteed O(log n) |
| AVL Tree | Self-Balancing BST |
|
| Strictly balanced (height difference ≤1); fewer rotations than Red-Black; slightly slower inserts but faster lookups |
| Red-Black Tree | Self-Balancing BST |
|
| Less strict balancing than AVL → fewer rotations on insert/delete; better for write-heavy workloads |
| B-Tree | Balanced Multi-Way Tree |
|
| Designed for block-oriented storage; reduces disk seeks; M typically 50-200 depending on block size |
| B+ Tree | B-Tree Variant |
|
| Better for range queries and full scans than B-tree; internal nodes more compact → more keys in memory |
| Trie (Prefix Tree) | String Search Tree |
|
| Compressed variants: Radix tree (compact edges), Ternary Search Tree (space-efficient) |
| Segment Tree | Range Query Tree |
|
| Lazy propagation allows range updates in O(log n); Fenwick tree (BIT) is simpler but less flexible |
The static files are identical to what the API returns, but with no rate limit and no server round trip. Use the API when you want a query and a content type; use the files when you want to cache one document.
curl "https://yjtoon.com/api/dataset/tree-data-structures?format=toon"
const res = await fetch( "https://yjtoon.com/static-data/dataset/tree-data-structures.toon" ); const toon = await res.text();
Rate limit: 120 requests per minute per IP, no key and no signup. API reference →