Re: [Sugar-devel] I'm looking for a tree...

2009-06-08 Thread James Zaki
Not sure if you have found an answer to this yet, but with more information about what you're trying to do could help with communicating the right solution. Again I think a hash table can answer your questions about fast-lookup, but it just depends your chosen key, and other requirements you might

Re: [Sugar-devel] I'm looking for a tree...

2009-06-08 Thread Benjamin M. Schwartz
I've had amazing difficulty communicating what I'm looking for here. Those closest thing is http://en.wikipedia.org/wiki/Rope_(computer_science) A rope is a binary tree that _imposes_ an ordering on its leaves that has nothing whatsoever to do with their values (the values are essentially

Re: [Sugar-devel] I'm looking for a tree...

2009-06-07 Thread James Zaki
Hey Benjamin, Taking a guess with the information you've given perhaps a hash tablehttp://en.wikipedia.org/wiki/Hash_tablecould help? Fast lookup/retrieval, but just have to consider what you would enumerate as the key, and loading. Let me know if you want some help applying this, memories of a

Re: [Sugar-devel] I'm looking for a tree...

2009-06-07 Thread Benjamin M. Schwartz
James Zaki wrote: Taking a guess with the information you've given perhaps a hash tablehttp://en.wikipedia.org/wiki/Hash_tablecould help? Python uses the term Dict to describe its built-in hash table. I do think a hash table could be helpful, for example, to maintain the reverse lookup mapping

Re: [Sugar-devel] I'm looking for a tree...

2009-06-07 Thread Sean DALY
Have you looked into an awk associative array? I understand it is stored internally as a hash table. I remember reading about a simulated multidimensional array (index,subscript); inserting a record in that case didn't involve any reindexing. Older awks were considered slow though, I have no idea

Re: [Sugar-devel] I'm looking for a tree...

2009-06-07 Thread Lucian Branescu
This http://www.python.org/dev/peps/pep-0372/ might be interesting. Perhaps it could get backported to 2.5. But it still has O(n) deletion. 2009/6/7 Benjamin M. Schwartz bmsch...@fas.harvard.edu: James Zaki wrote: Taking a guess with the information you've given perhaps a hash

Re: [Sugar-devel] I'm looking for a tree...

2009-06-07 Thread Benjamin M. Schwartz
Lucian Branescu wrote: This http://www.python.org/dev/peps/pep-0372/ might be interesting. Perhaps it could get backported to 2.5. But it still has O(n) deletion. It also doesn't have insertion at all (only append), and indexing (and reverse indexing) is O(n). --Ben signature.asc

Re: [Sugar-devel] I'm looking for a tree...

2009-06-07 Thread Carol Farlow Lerche
hash chaining only approaches order n if the table is very full (because of collisions). On Sun, Jun 7, 2009 at 8:07 AM, Benjamin M. Schwartz bmsch...@fas.harvard.edu wrote: Lucian Branescu wrote: This http://www.python.org/dev/peps/pep-0372/ might be interesting. Perhaps it could get

Re: [Sugar-devel] I'm looking for a tree...

2009-06-07 Thread Lucian Branescu
Would an ordered dictionary otherwise be all right, or am I misunderstanding your requirements? There are other implementations, like http://www.xs4all.nl/~anthon/Python/ordereddict/ 2009/6/7 Benjamin M. Schwartz bmsch...@fas.harvard.edu: Lucian Branescu wrote: This

Re: [Sugar-devel] I'm looking for a tree...

2009-06-07 Thread Benjamin M. Schwartz
Lucian Branescu wrote: Would an ordered dictionary otherwise be all right, or am I misunderstanding your requirements? There are other implementations, like http://www.xs4all.nl/~anthon/Python/ordereddict/ No, an ordered dictionary is not enough. All these ordered dictionaries are ordered

[Sugar-devel] I'm looking for a tree...

2009-06-06 Thread Benjamin M. Schwartz
I am looking for a fast data structure with the following properties: Maintains an indexed list of arbitrary, non-ordered objects (like a python List or C array) Allows fast: Insertion at any location Deletion at any location Lookup of an object by its index Reverse lookup, to determine the index