Tries, segment trees, Fenwick trees, B-trees, AVL and red-black trees, skip lists, bloom filters and disjoint sets.
39 cards · basic cards · AI-written, checked twice. Edit anything.
- What is a trie?
Show answer
A tree-based data structure where each node represents a character, used for efficient prefix-based searches.
- What is the time complexity of searching in a trie?
Show answer
O(m) where m is the length of the search string.
- What is the main disadvantage of tries regarding space?
Show answer
They use significant memory because each node can have up to 26 pointers for lowercase letters.
- What is a common use case for tries?
Show answer
Autocomplete and spell-checking systems.
- What property do tries enable for string searches?
Show answer
Prefix matching: finding all words that start with a given prefix.
- What is a segment tree?
Show answer
A tree data structure used to efficiently answer range queries and update point values.
- What is the time complexity for a range query in a segment tree?
Show answer
O(log n) where n is the size of the array.
- What is the time complexity for updating a value in a segment tree?
Show answer
O(log n).
- What is a common use case for segment trees?
Show answer
Range minimum, maximum, or sum queries on an array.
- What is a Fenwick tree?
Show answer
A data structure that efficiently supports prefix sum queries and point updates in O(log n) time.
- What is the time complexity of operations in a Fenwick tree?
Show answer
O(log n) for both updates and prefix sum queries.
- What is a primary use case for Fenwick trees?
Show answer
Computing prefix sums and handling range sum updates efficiently.
- What space advantage does a Fenwick tree have over a segment tree?
Show answer
Fenwick trees use O(n) space while segment trees typically use O(2n) space.
- What is a B-tree?
Show answer
A self-balancing tree where each node can have multiple children and keys, designed for external storage systems.
- What is the time complexity for search, insert, and delete in a B-tree?
Show answer
O(log n) in all cases.