Data Structures19 sections · 729 units
Open in Course

Section Recap

What you learned

Tries store strings with shared prefixes.

Each node represents a character, paths spell words. Core Operations:

  • Insert: O(L)O(L), create nodes along path
  • Search: O(L)O(L), follow path, check isEndOfWord
  • Prefix: O(L)O(L), like search but no end check

Patterns:

  • Wildcard search with DFS
  • Word dictionary with isEndOfWord flag
  • Autocomplete with prefix traversal

When to Use: String prefix problems, dictionary lookups, autocomplete systems.

Time: O(L)O(L) per operation. Space: O(ΣNL)O(\Sigma \cdot N \cdot L) worst case.