To move to the end:
Split at : get and
Split the second part at : get and
Merge:
Each split and merge is . With splits and merges, total time per operation is . This pattern (split, rearrange, merge) handles many sequence manipulation problems.
The split-merge dance
To move to the end:
Split at : get and
Split the second part at : get and
Merge:
Each split and merge is . With splits and merges, total time per operation is . This pattern (split, rearrange, merge) handles many sequence manipulation problems.