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

Việt Quân

New member
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)
 
Answer: c
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.
 

Tìm kiếm

Back
Top