+1 vote
in Data Structures & Algorithms I by (88.2k points)
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 I

I got this question in an interview.

1 Answer

+1 vote
by (672k points)
selected by
 
Best 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.

Related questions

Welcome to TalkJarvis QnA, a question-answer community website for the people by the people. On TalkJarvis QnA you can ask your doubts, curiosity, questions and whatever going in your mind either related to studies or others. Experts and people from different fields will answer.

Categories

...