1.

What is a time complexity for finding the total length of all string on all edges of a tree?(a) Ɵ (n)(b) Ɵ (n!)(c) Ɵ (1)(d) O (n^2)This is a very interesting question from Suffix tree topic in chapter Trie of Data Structures & Algorithms IThe question was posed to me by my college professor while I was bunking the class.

Answer»

Correct choice is (d) O (N^2)

The best I can EXPLAIN: 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 total length of all string on all edges of a tree is O (n^2).



Discussion

No Comment Found

Related InterviewSolutions