DSA Master › Topic 16

Trie & String Algorithms

A trie stores strings character by character so that words with a common prefix share a path. Prefix lookups cost O(length of word). KMP finds a pattern in a text in O(n + m) using a failure table.

Concepts

How to recognise it

Common pitfalls

Problems

  1. Implement Trie (Prefix Tree) (Medium)
  2. Design Add and Search Words Data Structure (Medium)
  3. Word Search II (Hard)
  4. Find the Index of the First Occurrence in a String (Easy)
  5. Repeated String Match (Medium)