Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Finger trees. They work on an arbitrary monoid and maintain a list of items. You can insert and remove items in logarithmic time, as well as ask for the sum of items in a given range, also in logarithmic time.

This is useful for example when you want to convert between offsets and line/column numbers efficiently, while you also want to efficiently update/insert/replace lines.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: