3 ms·
B-tree deletions are quite complicated too, requiring stealing keys from either-side sibling or merging with either-side sibling. In practice, I find that a B-
by nayuki 2y ago
B-tree deletions are quite complicated too, requiring stealing keys from either-side sibling or merging with either-side sibling.
In practice, I find that a B-tree implementation is 2 to 3× the length of an AVL tree impl.
I also fuzz-tested my implementations thoroughly. https://www.nayuki.io/page/avl-tree-list https://www.nayuki.io/page/avl-tree-list , https://www.nayuki.io/page/btree-set https://www.nayuki.io/page/btree-set , etc.
- DanielHB 2y agoYeah, this is what I was thinking too. The rebalancing on AVL is a bit tricky but once you grok it, it is not that much code...