Playground

Trie

Explore a prefix tree with insert, search, prefix lookup, and delete operations.

Trie Playground

A visual demonstration of a Prefix Tree (Trie). Watch how characters share paths, insert new words, and perform prefix searches.

Trie Node Structure

class TrieNode {
char: character;
children: Map<string, TrieNode>;
isEndOfWord: boolean;
}
100%

INSERT

function insert(word):
current = root
for char in word:
if current.children[char] not exists:
current.children[char] = new Node()
current = current.children[char]
current.isEndOfWord = true
Console Output
Insert words to watch the Trie build!