1.

What is the time taken for a range query for a perfectly balanced tree?(a) O(N)(b) O(log N)(c) O(√N+M)(d) O(√N)I want to ask this question from Trees topic in division Trees of Data Structures & Algorithms II got this question in an interview.

Answer»

The correct answer is (C) O(√N+M)

Easy EXPLANATION - For a perfectly balanced k-d tree, the RANGE QUERY could TAKE O(√N+M) in the worst case to report M matches.



Discussion

No Comment Found

Related InterviewSolutions