# What is the time complexity for finding the node at x position where n is the length of the rope?

Category: QuestionsWhat is the time complexity for finding the node at x position where n is the length of the rope?
Editor">Editor Staff asked 5 months ago

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.

Editor">Editor Staff answered 5 months ago

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).

Notice: Trying to get property 'ID' of non-object in /home/fvckxqmi/public_html/wp-content/themes/blocksy/inc/single/single-helpers.php on line 17

Notice: Trying to get property 'ID' of non-object in /home/fvckxqmi/public_html/wp-content/themes/blocksy/inc/single/single-helpers.php on line 17

Notice: Trying to get property 'ID' of non-object in /home/fvckxqmi/public_html/wp-content/themes/blocksy/inc/single/single-helpers.php on line 17

Notice: Trying to get property 'ID' of non-object in /home/fvckxqmi/public_html/wp-content/themes/blocksy/inc/single/single-helpers.php on line 17
Articles: 40702