3 ms·
You could keep pointers to both the head and tail in the list object though. Then adding and removing stuff would be O(1) for both ends.
by adsr 12y ago
You could keep pointers to both the head and tail in the list object though. Then adding and removing stuff would be O(1) for both ends.
- thaumaturgy 12y agoYep, and that used to be idiomatic, years and years ago when people still wrote their own linked lists. I'd be surprised if it isn't still the standard behavior for that data structure.