Re:What's wrong with this code, really?
by jbri on Friday September 16, 2011 @09:15AM
(#3004294)
Though you have to be careful with that, because the obvious code for removing from a collection in reverse:
Is itself a schlemiel algorithm on any singly-linked list...
[ Parent
| on HN ]
You're removing i+1 elements here :)
Re:What's wrong with this code, really?
by Confusion on Saturday September 17, 2011 @03:19AM
(#3007476)
That really depends on the implementation of the linked list. I don't think it would actually behave O(n^2) in most implementations.
Re:What's wrong with this code, really?
by willfarrell on Friday September 16, 2011 @11:43AM
(#3004890)
for(i = list.size; i--;)
list.removeAt(i);