A rope is a tree-like data structure that provides a more efficient way of concatenating strings. A valid rope must be either a node or a leaf. More specifically:
- A rope leaf always contains some string (whether it be empty or not).
- A rope node contains no string, but references to it鈥檚 left and right child nodes. The total length of all it鈥檚 children鈥檚 is a rope node鈥檚 value.
Concatenates two Ropes. Time complexity: O(1).
Deletes substring in Rope for given range. Time complexity: O(log N).
Get Char from Rope at index. Time complexity: O(log N).
Inserts String into Rope at index. Time complexity: O(log N).
Gets length of Rope. Time complexity: O(1).
Splits Rope at index into a Rope tuple. Time complexity: O(log N).
Gets substring for range in Rope. Time complexity: O(log N).
Casts Rope into String. Time complexity: O(N).