[Newbies] Iterating and removing items from OrderedCollections

Marcin Tustin mm3 at zepler.net
Thu Sep 18 09:38:52 UTC 2008


On 9/18/08, Yoshiki Ohshima <yoshiki at vpri.org> wrote:
>
> At Thu, 18 Sep 2008 10:00:15 +0100,
> Marcin Tustin wrote:
> >
> > Would this be O(n^2) to remove all nils?
>
> Not in a way it matters.  OrderedCollection moves items not eagarly.


Do you mean that it will do a lazy delete?


> In any case, if this is a conveyor belt, then you should almost certainly
> be using a linke data structure, and iterate
> > over the structure to delete the unwanted links.
>
> No in two reasons; 1) he wasn't talking about removing items in the
> middle


Look at the original example.

 and 2) OrderedCollection is usually more efficient than the
> naive LinkedList, as less dereferencing.  (And, it could get more
> benefits from using array manipulation primitives like
> replaceFrom:to:, but it can't at least for addFirst:.)


I think this would be an empirical question.


-- Yoshiki
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20080918/89d53470/attachment.htm


More information about the Beginners mailing list