Data Structures & AlgorithmsVery hardICPC regional · strings
Problem: What does the Booth's algorithm compute?
- A. The longest palindromic substring
- B. The lexicographically smallest rotation of a string in linear time
- C. The shortest path in a grid
- D. The number of divisors of an integer
Correct answer: B. The lexicographically smallest rotation of a string in linear time
Booth's algorithm uses a modified failure function to find the least rotation in O(n).
More Coding Interview Problems questions
- Problem: Which claim about the Manacher algorithm is correct?
- Problem: Which concept is used by the Rabin-Karp algorithm to compare substrings in constant time?
- Problem: What is the number of comparisons needed by heapsort in the worst case for n elements?
- Problem: Which algorithm finds the k-th smallest element in expected linear time?
- Problem: Which property does the KMP failure function of a string satisfy?
- Problem: Which is the time complexity of deciding whether an undirected graph has an Euler path?