Mercurial > public > think_complexity
changeset 16:a00e97bcdb4a
Oops, make it importable.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Tue, 18 Dec 2012 20:03:28 -0600 |
parents | b163f18eaf92 |
children | 977628018b4b |
files | redblacktree.py |
diffstat | 1 files changed, 3 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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.