Data Structures & AlgorithmsVery hardICPC regional · strings
Problem: Which structure gives fast membership tests of substrings after O(n) construction (for a fixed alphabet)?
- A. Binary heap
- B. Hash set of integers
- C. Suffix automaton
- D. Trie of integers
Correct answer: C. Suffix automaton
A suffix automaton recognises all substrings in linear size and time, which supports membership tests.
More Coding Interview Problems questions
- Problem: What is the expected number of rounds of a randomised min-cut (Karger's algorithm) needed for a graph with n vertices to find a…
- Problem: What does the term 'amortised analysis' mean?
- Problem: What is the complexity of computing the number of inversions using a Fenwick tree over n distinct values?
- Problem: Which operation is the bottleneck of the naive recursive Fibonacci algorithm?
- Problem: What is the worst-case complexity of Heapsort on n elements?
- Problem: What is the property of a 'Monge' matrix that enables fast DP optimisation?