# What is the time complexity for deleting the string to form a new string in the rope data structure?

Category: QuestionsWhat is the time complexity for deleting the string to form a new string in the rope data structure?
Editor">Editor Staff asked 5 months ago

What is the time complexity for deleting the string to form a new string in the rope data structure?

(a) O (n^2)

(b) O (n!)

(c) O (log n)

(d) O (1)

This is a very interesting question from Binary Trees in portion Binary Trees of Data Structures & Algorithms I

This question was posed to me in my homework.

Editor">Editor Staff answered 5 months ago

Correct choice is (c) O (log n)

For explanation: In order to perform the deletion on the rope data structure, one can delete the given string at any position x to form a new string in O (log n) time. So, the time complexity for worst case is O (log n). This can be done by two split operations and one concatenation operation.

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