1.

What is a time complexity for inserting an alphabet in the tree using hash maps?(a) O (log n!)(b) O (n!)(c) O (n^2)(d) O (1)The origin of the question is Suffix tree topic in chapter Trie of Data Structures & Algorithms IThis question was addressed to me during an interview.

Answer»

The correct choice is (d) O (1)

Best explanation: SUFFIX tree is also known as PAT tree or position tree. It allows fast string operation. Total time taken for construction of suffix tree is linear to the length of the tree. The time complexity for inserting an alphabet in the tree using hash MAPS is CONSTANT, O (1).



Discussion

No Comment Found

Related InterviewSolutions