← All Tools

Trie (Prefix Tree) Visualizer

A trie stores a dictionary by sharing common prefixes — every path from the root to a marked node spells one word. Insert words, type a prefix to watch autocomplete walk the matching branch, and read off how much space the shared prefixes save versus a flat list.

Trie statistics

Words0
Nodes1
Edges0
Max depth0
Total chars (flat)0
Chars stored (trie)0
Compression

Completions

  • type a prefix above

internal node   word ends here   on search path   last-inserted node

Why tries?

A trie answers does any stored word start with this prefix? in O(P) time where P is the prefix length — independent of how many words are in the dictionary. That's why autocomplete, IP-routing FIB lookups, and the suggest box in your editor reach for tries (or their compressed cousins, the radix / Patricia tree). Every node is either a path-shared prefix or a word boundary; the green ring marks word boundaries.

The compression number compares the total characters across all inserted words to the number of edge labels actually stored. The bigger the shared-prefix overlap, the better the trie does. With cat / car / cart / care the trie stores 7 characters instead of 14 — a 50 % saving.