PATHLIGHT
LESSON 05 OF 08Trie · insert & search
0% learnt
TRIE INSERT AND SEARCH · PREFIX TREE

After inserting “cat”, what should inserting “car” do with c → a?

Tries compress common prefixes. The path c → a already exists and must be reused.

RULE TO APPLYFollow one edge per character; success requires both a full path and an end marker.
LIVE ALGORITHM STATEc → a is shared; only the missing r branch needs to be created.
catword ✓r
INSERT “car”
car