Reference: "Introduction to Algorithms" - by Cormen, Leiserson, Rivest, Stein 

     This code has been released under the GNU License Agreement. Please refer to it for further details on copying and modifying this program.


    The source files and related demo graphs can be downloaded here.

    rbtree.c (source file download) 

 

   red-black tree 2          red-black tree 3

red-black tree 1

 Compiling:

    $ gcc -Wall -o rbtree rbtree.c

    should compile into a binary file with name "rbtree"

 Run the program with the output file mentioned as the argument. 

    $ ./rbtree rbtree.dot

 Then, use the following command to get a postscript file of the graph built

    $ dot -Tps < rbtree.dot > rbtree.ps

 On an ubuntu system, try the following to install "dot" and "dotty".
   
     $ sudo apt-get install graphviz

www.000webhost.com