2 ms·
Doesn't that run in quadratic time - or can delete_at() somehow avoid copying all the tail elements in the array?
by ssp 15y ago
Doesn't that run in quadratic time - or can delete_at() somehow avoid copying all the tail elements in the array?
- T-hawk 15y agoI know nothing about Ruby, but it's possible if a language implements an array as a linked list so the tail elements don't actually move. (At any rate, I hardly think we're worried about a modern computer workload of at most 25^2 string operations.)
- ssp 15y agoIn that case, it couldn't find the element to delete in constant time.