1.

What is a time complexity for finding the longest prefix that is common between suffix in a string?(a) Ɵ (n)(b) Ɵ (n!)(c) Ɵ (1)(d) O (log n!)This question is from Suffix tree in division Trie of Data Structures & Algorithms IThis question was posed to me in an interview.

Answer» RIGHT option is (c) Ɵ (1)

The best explanation: Suffix Tree allows fast string operation. To check if a substring is present in a string of a length of N, the time complexity for such operation is found to be O (n). The time complexity for finding the longest PREFIX that is COMMON between suffix in a string is Ɵ (1).


Discussion

No Comment Found

Related InterviewSolutions