Module 11 · Trie · Common Mistakes

Trie: common mistakes

A trie's words are marked at their last letter (a double ring); forget the mark and a prefix looks like a word. Here are two slips: search returning true without checking isEnding, and delete pruning a node that still ends a shorter word.

Pick a mistake and press play: Wrong runs the code with the mistake until it breaks, and the code marks the wrong line in red. Fixed runs the corrected code on the same input, with the corrected line in green.

Mistake
Code