Module 11 · Trie · Trie Operations and Applications

Search suggestions

Every product goes into a trie. Each letter typed moves iter one step down; every product under iter starts with what was typed. A depth-first walk under it, children from a to z, finds them in alphabetical order, and stops after three.

A double ring marks the end of a product. suggestions fills up during one walk; result keeps one list per letter typed.