+1 vote
in Data Structures & Algorithms I by (110k points)
What is the time complexity for finding the node at x position where n is the length of the rope?

(a) O (log n)

(b) O (n!)

(c) O (n^2)

(d) O (1)

I need to ask this question from Binary Trees in division Binary Trees of Data Structures & Algorithms I

This question was addressed to me in a job interview.

1 Answer

+1 vote
by (737k points)
selected by
 
Best answer
Right option is (a) O (log n)

For explanation: In order to find the node at x position in a rope data structure where N is the length of the rope, we start a recursive search from the root node. So the time complexity for worst case is found to be O (log N).

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

...