Skip to content
Putting It All Together
step 1/5

Reading — step 1 of 5

Read

~1 min readAutocomplete

Putting It All Together

A production trie/autocomplete system layers:

LayerLesson
Insert/contains1, 2
Prefix search3
Delete + prune4
Radix compression5
Top-K autocomplete6
Fuzzy search7

Beyond:

  • Persistent tries: stored on disk; lazy-load nodes. Used by JOSE, RocksDB.
  • Concurrent tries: lock per branch, or copy-on-write.
  • Suffix tries / suffix arrays: indexing all suffixes for substring search.
  • DAWG (Directed Acyclic Word Graph): merge equivalent subtries to save memory. Used by Scrabble dictionaries.

Real systems where you'll see them:

  • IDE auto-import suggestions (TypeScript, Rust)
  • Browser address bar suggestions
  • IP routing in Linux kernel
  • DNS suffix matching
  • Lucene FST (finite state transducer) — like a radix tree but with arbitrary outputs

You've now built the canonical version.

Discussion

Ask a question, share an insight, or help someone who’s stuck.

Sign in to post a comment or reply.

Loading…