Stores strings character by character so words with shared prefixes share a path. Insert, search, and prefix-match all run in O(L) for a word of length L.
Stores strings character by character so words with shared prefixes share a path. Insert, search, and prefix-match all run in O(L) for a word of length L.
Time complexity: O(L). Space complexity: O(n).
Use the interactive visualizer above to run Trie (Prefix Tree) on your own input and watch every comparison, swap, and operation animate step by step — pause, scrub, or replay at any speed.