473,385 Members | 1,753 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Balanced tree type coming in next Python?

I can't see anything about this in the notes on the upcoming
2.4 on python.org, but for some reason I thought I remembered
seeing that a balanced tree sequence type would be included
in Python in the near future. Is this correct?

Thanks,
Ken
Jul 18 '05 #1
6 1774
In article <sl*******************************@g4.gateway.2wir e.net>,
Kenneth McDonald <ke****************@sbcglobal.net> wrote:

I can't see anything about this in the notes on the upcoming 2.4 on
python.org, but for some reason I thought I remembered seeing that a
balanced tree sequence type would be included in Python in the near
future. Is this correct?


Not to my recollection. The only references I could find to balanced
trees was in conjunction with the discussion of the heapq module.
--
Aahz (aa**@pythoncraft.com) <*> http://www.pythoncraft.com/

"as long as we like the same operating system, things are cool." --piranha
Jul 18 '05 #2
On Mon, 07 Jun 2004 04:45:13 GMT, rumours say that Kenneth McDonald
<ke****************@sbcglobal.net> might have written:
I can't see anything about this in the notes on the upcoming
2.4 on python.org, but for some reason I thought I remembered
seeing that a balanced tree sequence type would be included
in Python in the near future. Is this correct?


Not AFAIK (although it would be a good addition to the new collections
module).

PS Any volunteers to port and maintain Judy arrays/trees for Python?-)
http://judy.sourceforge.net/
They'd be an interesting alternative to dictionaries in some cases (esp
very large dictionaries).
--
TZOTZIOY, I speak England very best,
"I have a cunning plan, m'lord" --Sean Bean as Odysseus/Ulysses
Jul 18 '05 #3
I'm not aware of any such feature to be added, but an AVL tree module is
available now:

http://www.nightmare.com/squirl/python-ext/avl/

On Mon, Jun 07, 2004 at 04:45:13AM +0000, Kenneth McDonald wrote:
I can't see anything about this in the notes on the upcoming
2.4 on python.org, but for some reason I thought I remembered
seeing that a balanced tree sequence type would be included
in Python in the near future. Is this correct?

Thanks,
Ken


Jul 18 '05 #4
Am Mon, 07 Jun 2004 12:57:09 +0300 schrieb Christos "TZOTZIOY" Georgiou:

PS Any volunteers to port and maintain Judy arrays/trees for Python?-)
http://judy.sourceforge.net/
They'd be an interesting alternative to dictionaries in some cases (esp
very large dictionaries).


Hi,

How do they compare to BTrees (ZODB)?

Regards,
Thomas

Jul 18 '05 #5
[Kenneth McDonald]
I can't see anything about this in the notes on the upcoming
2.4 on python.org, but for some reason I thought I remembered
seeing that a balanced tree sequence type would be included
in Python in the near future. Is this correct?


The docs for the collections module show that balanced trees are not
going in to Py2.4 but are under consideration an a future addition to
the module.
Raymond
Jul 18 '05 #6
On Mon, 07 Jun 2004 16:46:06 +0200, rumours say that "Thomas Guettler"
<gu*****@thomas-guettler.de> might have written:
PS Any volunteers to port and maintain Judy arrays/trees for Python?-)
http://judy.sourceforge.net/
They'd be an interesting alternative to dictionaries in some cases (esp
very large dictionaries).


How do they compare to BTrees (ZODB)?


I really don't know, to be honest; I have never used Zope's Btrees.

It's just that in some older C program of mine, with big data structures
running on a shared computer with lots of RAM but with limits per user,
I gave Judy trees a try and I was impressed by their speed and their
efficient usage of RAM. Since I was hitting my limits, before using
Judy trees I had retorted to using the C stdlib qsort and bsearch on
linear arrays (like Python lists); of course, the speed of adding
elements and re-running qsort was not impressive (no timsort in the C
stdlib :).

Before using Judy trees, my program used up to 492 MiB of ram (with
careful implementation so that realloc'ing my large list would just
extend it, not copy it to another address and then freeing the old
space); with Judy trees, it used about 508 MiB, which was inside my
limit of 512, and much faster.

I haven't tried so far to port Judy trees to Python; ISTR that somebody
did an attempt using Pyrex, but never gave it a shot. Python dicts are
excellent, but memory inefficient on large amounts of data. Also, they
are not the right structure to use if you want range checks. Trees do
have their use, as you surely know.
--
TZOTZIOY, I speak England very best,
"I have a cunning plan, m'lord" --Sean Bean as Odysseus/Ulysses
Jul 18 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: abhrajit | last post by:
I'm looking for a C/C++/Java library to create a balanced binary tree data structure given a set of leaf nodes as input. A leaf node should never become an interior node. So if I wish to create...
0
by: Chad Whitacre | last post by:
Hey all, I've been playing around with the parser module, and based on the documentation I would expect all symbols in a parse tree to be part of the grammar. For example, I find this line in...
15
by: Xah Lee | last post by:
Here's the belated Java solution. import java.util.List; import java.util.ArrayList; import java.lang.Math; class math { public static List range(double n) { return range(1,n,1); }
7
by: Peter Tkacz | last post by:
Are there any data types within STL that implement a balanced tree? Peter
1
by: Koen | last post by:
Hi all, I created a little database to manage my e-books. The program will synchronize a table with the contents of a directory. Works great. Because I keep additional info (like keywords) to...
1
by: Daniel Bass | last post by:
Using VC#.Net, I want to take a statement, that loosely follows the rules of an SQL'a "WHERE" statement, and determine whether that statement is true or false. For example: ( ( Head = 'abc')...
6
by: BA | last post by:
Hi Everyone, I have an application that sits behind a server farm, the application needs to pass its NLB IP address in the message that it sends to another service. From C# code, how can I...
6
by: Bart Kastermans | last post by:
I am playing with some trees. In one of the procedures I wrote for this I am trying to change self to a different tree. A tree here has four members (val/type/left/right). I found that self = SS...
0
by: kasthurirangan.balaji | last post by:
Hello, I have some items in memory(character array) separarted with the newline character and the items are sorted inside the array. I already have a version of the code using a multimap object....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.