Lines Matching refs:red
4 # Purpose: red-black tree module (Julienne Walker's none recursive algorithm)
15 # deletion algorithm, red black trees become very tricky. However, the
21 # So when do you use a red black tree? That's really your decision, but I've
22 # found that red black trees are best suited to largely random data that has
24 # takes full advantage of the minimal work that red black trees perform to
29 # implemented with a red black tree. Red black trees are also comparable in
31 # to maintain balance is usually better in a red black tree. There are a few
32 # misconceptions floating around, but for the most part the hype about red black
44 __slots__ = ['key', 'value', 'red', 'left', 'right']
49 self.red = True
72 if (node is not None) and node.red:
83 root.red = True
84 save.red = False
100 A red-black tree is a type of self-balancing binary search tree, a data
107 total number of elements in the tree. Put very simply, a red-black tree is a
155 self._root.red = False # make root black
174 node.red = True
175 node.left.red = False
176 node.right.red = False
178 # Fix red violation
201 self._root.red = False # make root black
215 # Search and push a red down
230 # Push the red node down
240 parent.red = False
241 sibling.red = True
242 node.red = True
250 grand_parent[direction2].red = True
251 node.red = True
252 grand_parent[direction2].left.red = False
253 grand_parent[direction2].right.red = False
266 self._root.red = False