System InternalsLearn ↗Trie AutocompleteINSERTSUGGEST

Trie Autocomplete — pick a scenario

0/3 done

Pick one and press Start, then click Next › to step through it.

Watch for

The walk stopping at the shared prefix node, then fanning out to gather only the words below it — an absent prefix has no node, so it returns nothing.

More about this scenario
You'll learn

How a trie turns a shared-prefix tree into instant autocomplete ranked by popularity.

How it runs

Each INSERT walks (or creates) one node per character and marks the end node with the word's frequency. SUGGEST walks to the prefix node, then collects the words beneath it and ranks them by frequency, taking the top K.