Rope data structure implementation in Hare.
Hare 94.9%
Makefile 5.1%
8 1 0

Clone this repository

https://tangled.org/stau.space/hare-rope
git@tangled.org:stau.space/hare-rope

For self-hosted knots, clone URLs may differ based on your setup.

README.md

Hare Rope Implementation.#

A Rope is a data structure that manages an ordered set of characters. Just like a string!

You can read more about it on its Wikipedia article.

Some of the key Big-O differences are the following:

Operation Rope String
Index O(log n) O(1)
Split O(log n) O(1)
Concatenate O(1) amort., O(log n) worst O(n)
Iterate over each character O(n) O(n)
Insert O(log n) O(n)
Append O(1) amort., O(log n) worst O(1) amort., O(n) worst
Delete O(log n) O(n)
Report O(j + log n) O(j)
Build O(n) O(n)

Table taken from Comparison with monolithic arrays