2 ms·
I'd probably do a doubly linked list for the test document. Then you're looking at O(1) for operations I think.
by bochoh 7y ago
I'd probably do a doubly linked list for the test document. Then you're looking at O(1) for operations I think.
- zabzonk 7y agoNot 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.
- DonaldFisk 7y agoI'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.