Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Backoprted singleton, NilNode() -> NilNode.instance()

  • Loading branch information...
commit 2bf9d830405fca391f43828658f057dc4c05614d 1 parent 3328478
@radarek radarek authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 red_black_tree.py
View
6 red_black_tree.py
@@ -7,7 +7,7 @@ def __init__(self, key, color = RED):
raise TypeError("Bad value for color parameter, expected True/False but given %s" % color)
self.color = color
self.key = key
- self.left = self.right = self.parent = NilNode()
+ self.left = self.right = self.parent = NilNode.instance()
def __str__(self, level = 0, indent = " "):
s = level * indent + str(self.key)
@@ -46,7 +46,7 @@ def __bool__(self):
class RedBlackTree:
def __init__(self):
- self.root = NilNode()
+ self.root = NilNode.instance()
self.size = 0
def __str__(self):
@@ -217,7 +217,7 @@ def __right_rotate(self, x):
x.parent = y
def __insert_helper(self, z):
- y = NilNode()
+ y = NilNode.instance()
x = self.root
while x:
y = x
Please sign in to comment.
Something went wrong with that request. Please try again.