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

I'd probably do a doubly linked list for the test document. Then you're looking at O(1) for operations I think.


Not for searching. Linked lists are fine if you are at the point where you need to do an operation, but getting to that point can be expensive.


I'd strongly recommend using a gap buffer for storing the text in while it's being edited, and within reason I wouldn't worry too much about runtime performance, as any reasonable solution should be able to keep up with a user typing.




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

Search: