1.

Given input string = “ABCDABCATRYCARCABCSRT” and pattern string = “CAT”. Find the first index of the pattern match using quick search algorithm.(a) 2(b) 6(c) 11(d) 14The question was posed to me during an interview.I would like to ask this question from String Matching topic in chapter String Matching of Data Structures & Algorithms II

Answer»

The correct option is (b) 6

The explanation is: 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.



Discussion

No Comment Found

Related InterviewSolutions