samedi 11 avril 2020

Rope (data structure) C++, write split feature

Help

https://iq.opengenus.org/rope-data-structure/ writing c++ for split(i):

Split(I) In order to split a string at any given point i, there are 2 major cases we might encounter:

Split point being the last character of a leaf node. Split point being a middle character of a leaf node. With the second case, we can reduce it to the much simpler first one by splitting the string at given point into 2 leaf nodes & creating a new parent for these component strings. Follow this with subtracting the weights of the cut off parts from the parent nodes and re-balancing the tree.

Thanks a lot.

Aucun commentaire:

Enregistrer un commentaire