[Tutor] Code critique? [Red-Black balanced binary trees]
Danny Yoo
dyoo at hkn.eecs.berkeley.edu
Tue Oct 7 01:59:52 EDT 2003
Hi everyone,
I had some time today, and I wanted to understand Red-Black trees a little
more. I ran into them a few times on Tutor before, especially whenever
asked for a sorted Dictionary.
http://mail.python.org/pipermail/tutor/2002-November/018864.html
They're a neat data structure. I have to admit, though, that I didn't
really quite get how red-black trees worked. So I spent this afternoon
coding another red-black tree module. *grin*
I also wanted to get a lot more familiar with the 'unittest' module,
http://www.python.org/doc/lib/module-unittest.html
so the code comes with a few unit tests. Can anyone help me by critiquing
the implementation and suggesting other good things to test?
The code is here at the moment:
http://hkn.eecs.berkeley.edu/~dyoo/python/red_black/red_black.py
and as soon as it's more stable and useful (and is better documented), I
can package it up using distutils.
Thanks again!
More information about the Tutor
mailing list