thanks for the explanation.
Stef On 25 mai 07, at 10:06, Avi Bryant wrote: > On 5/24/07, Chris Muller <[hidden email]> wrote: >> I'll add, BTree's useful outside of OODB's too. > > Yes, to be specific: it's useful any time you need a Dictionary-like > collection where the keys are Magnitudes (ie, implement #<=). > > What you get: efficient sorted iteration through the keys, possibly > limited to a given range. For example, if you store a list of people > keyed by their birthdate, and then want to find everyone born in a > certain year, in order of birth, you can do that very fast. > > Also in the BTree package is a TSTree, which has similar properties > for String keys. So as well as keeping them sorted, you can do > efficient lookups of all the keys with a given prefix. One other neat > trick TSTree can do is a certain amount of fuzzy matching (eg find all > keys with an edit distance of 3 from 'foo') which makes it especially > useful for spell checking and similar applications. > > Avi > > |
In reply to this post by Damien Cassou-3
>From: "Damien Cassou" <[hidden email]>
>Reply-To: The general-purpose Squeak developers >list<[hidden email]> >To: "The general-purpose Squeak developers >list"<[hidden email]> >Subject: Re: About MappedCollection >Date: Fri, 25 May 2007 10:47:27 +0200 > >To me, LinkedLists are useful when you want a sequenceable collection >with removal and insertion functionalities. I think the problem is that Squeak (Smalltalk in general?) LinkLists are very specialized and not really usable as a normal collection. _________________________________________________________________ Make every IM count. Download Messenger and join the im Initiative now. Its free. http://im.live.com/messenger/im/home/?source=TAGHM_MAY07 |
In reply to this post by Avi Bryant-2
>From: "Avi Bryant" <[hidden email]>
>Reply-To: The general-purpose Squeak developers >list<[hidden email]> >To: "The general-purpose Squeak developers >list"<[hidden email]> >Subject: Re: About MappedCollection >Date: Fri, 25 May 2007 11:21:16 -0700 > >Either you can have transparency, or you can have O(1) >insertion/removal, but I don't see how you can have both. To get >O(1), you have to have a reference to the link you want to remove or >insert after, which isn't transparent; if you just had a regular >object like you would put in an OrderedCollection, you would have to >do a linear scan through the list to find the right link, and you're >back to O(n). No? > >Avi Well you can have O(1) insert at either end with a plain singly linked list (so long as the interface object has a link to the head *and* the tail). It is true that removals will have to be O(n) for generic objects, but a generic linked list is still valuable for various different algorithms (e.g. LIFO, FIFO). LinkedLists aren't (or at least shouldn't be) expected to be good at what e.g. vectors excel at. _________________________________________________________________ PC Magazines 2007 editors choice for best Web mailaward-winning Windows Live Hotmail. http://imagine-windowslive.com/hotmail/?locale=en-us&ocid=TXT_TAGHM_migration_HM_mini_pcmag_0507 |
In reply to this post by Avi Bryant-2
>From: "Avi Bryant" <[hidden email]>
>Reply-To: The general-purpose Squeak developers >list<[hidden email]> >To: "The general-purpose Squeak developers >list"<[hidden email]> >Subject: Re: About MappedCollection >Date: Fri, 25 May 2007 12:19:43 -0700 > >I understand what you mean by transparent, but with that kind of an >interface, you have the same algorithmic complexity as an >OrderedCollection, so what's the point? Actually OrderedCollection is analogues to the C++ STL "vector" implementation (flat space of some fixed size, if it is going to be exceeded an expensive expand and possibly copy happens). The STL also has a doubly linked list implementation called "list" which has very different characteristics (random access is much slower, insert or removal at either end is O(1)). _________________________________________________________________ PC Magazines 2007 editors choice for best Web mailaward-winning Windows Live Hotmail. http://imagine-windowslive.com/hotmail/?locale=en-us&ocid=TXT_TAGHM_migration_HM_mini_pcmag_0507 |
Free forum by Nabble | Edit this page |