Data Structures & Algorithms Matching Multiple Choice Questions on “Quick Search Algorithm”.
1. Which of the following is the fastest algorithm in string matching field?
a) Boyer-Moore’s algorithm
b) String matching algorithm
c) Quick search algorithm
d) Linear search algorithm
Answer: c
Clarification: Quick search algorithm is the fastest algorithm in string matching field whereas Linear search algorithm searches for an element in an array of elements.
2. Which of the following algorithms formed the basis for the Quick search algorithm? Answer: a 3. What is the time complexity of the Quick search algorithm? Answer: c 4. What character shift tables does quick search algorithm use? Answer: b 5. What is the space complexity of quick search algorithm? Answer: a 6. Quick search algorithm starts searching from the right most character to the left. Answer: b 7. What character shift tables does Boyer-Moore’s search algorithm use? Answer: d 8. What is the worst case running time in searching phase of Boyer-Moore’s algorithm? Answer: d 9. The searching phase in quick search algorithm has good practical behaviour. 10. Given input string = “ABCDABCATRYCARCABCSRT” and pattern string = “CAT”. Find the first index of the pattern match using quick search algorithm. Answer: b
a) Boyer-Moore’s algorithm
b) Parallel string matching algorithm
c) Binary Search algorithm
d) Linear Search algorithm
Clarification: Quick search algorithm was originally formed to overcome the drawbacks of Boyer-Moore’s algorithm and also for increased speed and efficiency.
a) O(n)
b) O(log n)
c) O(m+n)
d) O(mn)
Clarification: The time complexity of the Quick search algorithm was found to be O(m+n) and is proved to be faster than Boyer-Moore’s algorithm.
a) good-character shift tables
b) bad-character shift tables
c) next-character shift tables
d) both good and bad character shift tables
Clarification: Quick search algorithm uses only bad character shift tables and it is one of the reasons for its increased speed than Boyer-Moore’s algorithm.
a) O(n)
b) O(log n)
c) O(m+n)
d) O(mn)
Clarification: The space complexity of quick search algorithm is mathematically found to be O(n) where n represents the input size.
a) true
b) false
View Answer
Clarification: Quick search algorithm starts searching from the left most character to the right and it uses only bad character shift tables.
a) good-character shift tables
b) bad-character shift tables
c) next-character shift tables
d) both good and bad character shift tables
Clarification: Boyer-Moore’s search algorithm uses both good and bad character shift tables whereas quick search algorithm uses only bad character shift tables.
a) O(n)
b) O(log n)
c) O(m+n)
d) O(mn)
Clarification: If the pattern occurs in the text, the worst case running time of Boyer-Moore’s algorithm is found to be O(mn).
a) true
b) false
Answer: a
Clarification: During the searching phase, the comparison between pattern and text characters can be done in any order. It has a quadratic worst case behaviour and good practical behaviour.
a) 2
b) 6
c) 11
d) 14
Clarification: By using quick search algorithm, the given input text string is preprocessed and starts its search from the left most character and finds the first occurrence of the pattern at index=2.