YUNOVA · Data Structures & Algorithms

Module 13: Advanced data structures

Notes for offline study · 30 November 2026

Trie data structure

Key points

  • A trie stores strings character by character along paths from the root.
  • Insert and search take O(L) time for a word of length L.
  • Tries answer prefix queries such as autocomplete efficiently.

Fenwick tree (Binary Indexed Tree)

Key points

  • A Fenwick tree supports prefix sums and point updates in O(log n).
  • It moves through indices using i & -i, the lowest set bit.
  • A range sum is prefix(r) - prefix(l - 1).

Monotonic stack and deque problems

Key points

  • A monotonic stack keeps elements in increasing or decreasing order.
  • It finds the next greater or smaller element for every item in O(n).
  • A monotonic deque gives the sliding window maximum in O(n).

Free on YUNOVA · yunova.in · Sign in to add your own lesson notes to this sheet.