Simulation · deterministic model

Trie and autocomplete visualizer

Feed it a vocabulary, type a prefix, and watch the tree narrow — one character, one branch at a time — into the suggestions a search box would show you.

Workspace/trie
RUNS LOCALLY

Trie visualizer

Say it the way you would say it to a person. Your words are matched to one of 18 tools by readable rules, and the tool runs right here in your browser. No upload, no account.

/ tools⌘K search↑ last message

Trie visualizerRuns on this device · nothing uploaded

This tool runs in your browser and needs JavaScript turned on.

How to use the trie visualizer

  1. Enter your vocabulary in the settings form, one word or phrase per line. An example list is filled in.
  2. Ask for a prefix: “autocomplete words starting with re”.
  3. Follow the traversal down the tree, one character at a time.
  4. Read the suggestions under the matched node, ranked by how often each word appears in your list.

Things you can type: autocomplete words starting with re words that begin with ra

Why autocomplete is instant

A search box with ten million terms behind it responds before you finish typing, and it does not do that by scanning ten million strings. It walks a tree where every node is one character and every path from the root is a prefix.

By the time you have typed four characters, the candidate set is whatever hangs below one node. The work is proportional to the length of what you typed, not to the size of the vocabulary — which is why the response time does not change as the index grows.

What the visualizer shows

  • The tree built from your word list, with shared prefixes stored once.
  • The node count, so you can see the compression: shared prefixes never store a character twice.
  • The traversal for your prefix, character by character.
  • The suggestions below the matched node, ranked by frequency.

The same structure, elsewhere

Tries turn up wherever prefixes matter: IP routing tables, dictionary lookups, spell-checkers, and the tokenizer vocabularies that decide how your text is split before a model ever sees it. If you have used the token counter on this site, you have used a structure very much like this one.

Questions

Trie visualizer: common questions

How is a trie different from a hash map?

A hash map answers "is this exact key present". A trie answers "what keys start with this", which is a different question and the one autocomplete needs. It also shares storage between words with common prefixes.

Why are duplicate words ranked higher?

Frequency is the simplest useful ranking signal for suggestions. Repeat a word in the input list and watch it move up — real systems weight by popularity for exactly this reason.

Does this handle non-English text?

Yes. The tree is built over characters, so any script works, though languages without spaces need segmentation before the word list makes sense.