0Pricing
Competitive Programming Academy · Lesson

Tries for Prefix Lookups

Store and query word prefixes fast.

Storing Words Smartly

A trie is a tree that stores words by sharing common prefixes. It makes prefix questions lightning fast. 🌳

Why Not Just a Set

A set answers full-word lookups, but tries also answer prefix queries like does any word start with pre.

All lessons in this course

  1. KMP Prefix Function
  2. Polynomial String Hashing
  3. Z-Function for Pattern Search
  4. Tries for Prefix Lookups
← Back to Competitive Programming Academy