# HG changeset patch # User Brian Neal # Date 1355882608 21600 # Node ID a00e97bcdb4a80dc8b9a4ee75e88317d191b0889 # Parent b163f18eaf925ec876eafbe5d9f1d6f9c7c41c45 Oops, make it importable. diff -r b163f18eaf92 -r a00e97bcdb4a redblacktree.py --- a/redblacktree.py Tue Dec 18 19:54:04 2012 -0600 +++ b/redblacktree.py Tue Dec 18 20:03:28 2012 -0600 @@ -24,7 +24,7 @@ """ -BLACK, RED = range(1) +BLACK, RED = range(2) class Node(object): """A node class for red-black trees. @@ -32,7 +32,8 @@ A node has an optional parent, and optional left and right children. Each node also has a color, either red or black. A node has a key and an optional value. The key is used to order the red black tree by calling the "<" - operator when comparing keys. + operator when comparing keys. The optional value is useful for using the + red-black tree to implement a map datastructure. In a red-black tree, nil children are always considered black.