Re: using a binary tree container

2011-02-22 Thread Lutger Blijdestijn
Sorry I almost forgot: http://d.puremagic.com/issues/show_bug.cgi?id=5640 The issue with remove is talked about in digitalmars.D and perhaps not really specific to RedBlackTree.

Re: using a binary tree container

2011-02-18 Thread Stewart Gordon
On 11/02/2011 12:30, Dominic Jones wrote: Would that not be constructing an associated array? Whilst an associated array would do the job, there is no value for the "key:value" pair, just a list of keys. In the C++ STL there are the "set" and "map" containers. I want something like "set". Domi

Re: using a binary tree container

2011-02-14 Thread Steven Schveighoffer
On Sun, 13 Feb 2011 09:29:14 -0500, Lutger Blijdestijn wrote: Dominic Jones wrote: Hello, I have a list of strings and I want to determine whether or not a particular string in the is in that list. Assuming I should store the list of strings in a binary tree to facilitate fast searching,

Re: using a binary tree container

2011-02-13 Thread Mafi
Am 12.02.2011 00:02, schrieb spir: On 02/11/2011 10:33 PM, Mafi wrote: I allways try to import 'algorythm' because of the german word 'Algorythmus'. When this happend for the first time, I spent about five minutes to find out what's wrong. It is spelled Algorithmus in German, no ypsilon ;-) h

Re: using a binary tree container

2011-02-13 Thread Lutger Blijdestijn
Dominic Jones wrote: > Hello, > > I have a list of strings and I want to determine whether or not a > particular string in the is in that list. Assuming I should store the list > of strings in a binary tree to facilitate fast searching, I had a look at > the std.container documentation and found

Re: using a binary tree container

2011-02-13 Thread spir
On 02/13/2011 01:18 AM, Ali Çehreli wrote: On 02/11/2011 04:55 PM, spir wrote: Also, trees are not always O(logN): tries () are O(1) for access, relative to number of elements, in fact their search is not related to that factor, just like hash table instead to the length of keys (O(log(leng

Re: using a binary tree container

2011-02-12 Thread Ali Çehreli
On 02/11/2011 04:55 PM, spir wrote: > Also, trees are not always O(logN): tries () are O(1) for access, > relative to number of elements, in fact their search is not related to > that factor, just like hash table instead to the length of keys > (O(log(length)). Yep. I should know: I had written

Re: using a binary tree container

2011-02-11 Thread spir
On 02/12/2011 12:56 AM, Ali Çehreli wrote: On 02/11/2011 10:35 AM, spir wrote: D's builtin AAs seem /very/ fast on key access. You'd probably have a hard time even approaching their performance using whatever kind of tree (or rather, of trie). That is expected. D AAs are hash tables, meani

Re: using a binary tree container

2011-02-11 Thread Ali Çehreli
On 02/11/2011 10:35 AM, spir wrote: > D's builtin AAs seem /very/ fast > on key access. You'd probably have a hard time even approaching their > performance using whatever kind of tree (or rather, of trie). That is expected. D AAs are hash tables, meaning that they provide O(1) complexity for e

Re: using a binary tree container

2011-02-11 Thread spir
On 02/11/2011 10:33 PM, Mafi wrote: Am 11.02.2011 21:38, schrieb Steven Schveighoffer: On Fri, 11 Feb 2011 14:46:26 -0500, Tom wrote: what with this?: auto arr = ["foo", "bar", "aaa", "zzz"]; sort(arr); assert(canFind("foo")); assert(canFind("aaa")); assert(!canFind("aa")); I had a "Error 1 E

Re: using a binary tree container

2011-02-11 Thread Mafi
Am 11.02.2011 21:38, schrieb Steven Schveighoffer: On Fri, 11 Feb 2011 14:46:26 -0500, Tom wrote: what with this?: auto arr = ["foo", "bar", "aaa", "zzz"]; sort(arr); assert(canFind("foo")); assert(canFind("aaa")); assert(!canFind("aa")); I had a "Error 1 Error: module algorithem is in file 's

Re: using a binary tree container

2011-02-11 Thread Steven Schveighoffer
On Fri, 11 Feb 2011 14:46:26 -0500, Tom wrote: what with this?: auto arr = ["foo", "bar", "aaa", "zzz"]; sort(arr); assert(canFind("foo")); assert(canFind("aaa")); assert(!canFind("aa")); I had a "Error 1 Error: module algorithem is in file 'st

Re: using a binary tree container

2011-02-11 Thread spir
On 02/11/2011 08:46 PM, Tom wrote: what with this?: auto arr = ["foo", "bar", "aaa", "zzz"]; sort(arr); assert(canFind("foo")); assert(canFind("aaa")); assert(!canFind("aa")); I had a "Error 1 Error: module algorithem is in file 'std\algorithem.d

Re: using a binary tree container

2011-02-11 Thread Tom
what with this?: auto arr = ["foo", "bar", "aaa", "zzz"]; sort(arr); assert(canFind("foo")); assert(canFind("aaa")); assert(!canFind("aa")); I had a "Error 1 Error: module algorithem is in file 'std\algorithem.d' which cannot be read main.d " when I

Re: using a binary tree container

2011-02-11 Thread spir
On 02/11/2011 06:55 PM, spir wrote: On 02/11/2011 01:30 PM, Dominic Jones wrote: == Quote from bearophile (bearophileh...@lycos.com)'s article Dominic Jones: I have a list of strings and I want to determine whether or not a particular string in the is in that list. What about using: size_t[st

Re: using a binary tree container

2011-02-11 Thread spir
On 02/11/2011 01:30 PM, Dominic Jones wrote: == Quote from bearophile (bearophileh...@lycos.com)'s article Dominic Jones: I have a list of strings and I want to determine whether or not a particular string in the is in that list. What about using: size_t[sting] yourStringSet; Bye, bearophile

Re: using a binary tree container

2011-02-11 Thread bearophile
Dominic Jones: > Would that not be constructing an associated array? Whilst an associated array > would do the job, there is no value for the "key:value" pair, just a list of > keys. > In the C++ STL there are the "set" and "map" containers. I want something > like "set". Phobos2 is young, and

Re: using a binary tree container

2011-02-11 Thread Dominic Jones
== Quote from bearophile (bearophileh...@lycos.com)'s article > Dominic Jones: > > I have a list of strings and I want to determine whether or not a particular > > string in the is in that list. > What about using: > size_t[sting] yourStringSet; > Bye, > bearophile Would that not be constructing a

Re: using a binary tree container

2011-02-11 Thread spir
On 02/11/2011 01:05 PM, bearophile wrote: Dominic Jones: I have a list of strings and I want to determine whether or not a particular string in the is in that list. What about using: size_t[sting] yourStringSet; Bye, bearophile bool[sting] yourStringSet; does the job and better matches se

Re: using a binary tree container

2011-02-11 Thread bearophile
Dominic Jones: > I have a list of strings and I want to determine whether or not a particular > string in the is in that list. What about using: size_t[sting] yourStringSet; Bye, bearophile