home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!ukma!darwin.sura.net!aplcen.apl.jhu.edu!ddsdx2.jhuapl.edu!dlc
- From: dlc@ddsdx2.jhuapl.edu (Dave Collard x7468)
- Subject: Re: Wanted: Red-Black Trees
- Message-ID: <1992Nov11.182456.5788@aplcen.apl.jhu.edu>
- Sender: news@aplcen.apl.jhu.edu (USENET News System)
- Organization: Johns Hopkins University
- References: <1992Nov11.103156.1@happy.colorado.edu>
- Distribution: usa
- Date: Wed, 11 Nov 92 18:24:56 GMT
- Lines: 43
-
- In <1992Nov11.103156.1@happy.colorado.edu> srheintze@happy.colorado.edu writes:
-
- >Does anyone have source to an implementation of Red-Black trees?
- Yes, but I cannot give you my version. A 'C' version was posted
- to comp.sources.misc back in February by James Plank at
- jsp@Princeton.EDU
-
- I have that and can mail it to you if you want. I have never run or
- built or tested it. It is in shar format.
-
- csh> ls -l rbtree
- -rw-r--r-- 1 dlc general 30193 Nov 11 13:16 rbtree
-
- >I was going to type one in from a textbook (anyone know of a text book that has
- >Red-Black tree?) but if anyone has a softcopy it would save me the trouble.
-
- Two references: _Algorithms_ Robert Sedgewick 1983 Addison-Wesley
- _Introduction to Algorithms_ by Cormen, Leiserson, Rivest
- 1990 Massachusetts Institute of Technology
-
- Cormen has a much better (read: easier to understand) description of red-black
- trees. However, the Sedgewick algorithm is more efficient in storage because
- the parent of each node is not stored. I have also tested both algorithms and
- the Sedgewick algorithm keeps the height of the tree slightly less than the
- Cormen algorithm. I never figured out exactly why.
-
- The basic properties of a red-black tree are:
-
- 1) Nodes are colored red or black
- 2) Null leaves are considered black
- 3) Children of red nodes are black
- 4) Every simple path from a node to a descendant
- leaf contains the same number of black nodes
-
-
- >Does anyone understand the performance difference between red-black trees and
- >AVL trees? Does anyone have reference on this topic?
-
- See above.
-
- --Thor
- collard@capsrv.jhuapl.edu
- dlc@ddsdx2.jhuapl.edu
-