Adaptive Radix Tree

How to build sorted maps with tries instead of balanced trees

Tries offer an alternative to BSTs and hash maps for sorted iteration: walk keys byte-by-byte instead of comparing them. This tutorial builds an Adaptive Radix Tree from first principles, adding one optimization per chapter until you understand both the tradeoffs (cache locality vs. sparse keysets) and the production implementation.

Read full essay on Substack ↗

Questions this essay answers

  • When should I use a trie instead of a B-tree or red-black tree for a sorted map?
  • How does an Adaptive Radix Tree reduce memory waste in sparse tries?
  • Why does byte-by-byte traversal eliminate the need for key comparison?
← All essays