Trie Delete
Unmark the terminal; prune nodes upward while they have no children and are not terminal.
Decision · step 2 of 5Trie: Delete a word and prune its tail
Walking "cart" reaches its last node, which is terminal. Drop that mark: the word is gone, though its letters may still be needed by other words.
What you will see
The terminal marker goes; dangling nodes disappear from the leaf upward.
Cost
| Best | O(L) |
|---|---|
| Average | O(L) |
| Worst | O(L) |
| Space | O(L) |
How you work with it here
play it through, step one change at a time, scrub to any step, run it on your own input, predict what happens next.
Screen readers: Text and pattern cells announce index and character; each step announces the aligned positions, the comparison result and the shift.
Reduced motion: The pattern row snaps to its new alignment with a crossfade instead of sliding.
Before this
Taught by the same lesson
Trie covers these too, in the same run.