Data Structures & AlgorithmsHardICPC regional · strings
Problem: Which problem is solved by the Aho-Corasick automaton?
- A. Shortest path with negative edges
- B. Minimum spanning tree
- C. Finding all occurrences of many patterns in one text pass
- D. Assignment problem
Correct answer: C. Finding all occurrences of many patterns in one text pass
Aho-Corasick builds a trie with failure links, so a single scan of the text reports every pattern occurrence.
More Coding Interview Problems questions
- Problem: Which claim about the centroid decomposition of a tree is correct?
- Problem: What is the complexity of answering distance queries on a tree after O(n log n) preprocessing with the sparse-table LCA?
- Problem: In a Fenwick tree over n positions, what is the cost of a range-sum query combined with point updates?
- Problem: Which property must a function have for ternary search to find its maximum correctly?
- Problem: Dijkstra with a binary heap on a graph with E = 10^6 edges and V = 10^5 vertices runs in roughly how many elementary operations?
- Problem: Which statement about Hopcroft-Karp is correct?