Lines Matching refs:root
47 """The splay tree itself is just a reference to the root of the tree."""
51 self.root = None
55 return not self.root
61 self.root = Node(key, value)
64 # the key to the root of the tree.
67 if self.root.key == key:
71 if key > self.root.key:
72 node.left = self.root
73 node.right = self.root.right
74 self.root.right = None
76 node.right = self.root
77 node.left = self.root.left
78 self.root.left = None
79 self.root = node
89 if self.root.key != key:
91 removed = self.root
92 # Link out the root node.
93 if not self.root.left:
95 self.root = self.root.right
98 right = self.root.right
99 # Make the original left child the new root.
100 self.root = self.root.left
101 # Splay to make sure that the new root has an empty right child.
104 # root.
105 self.root.right = right
113 if self.root.key == key:
114 return self.root
121 current = self.root
130 current = self.root
142 # Now the result is either the root node or the greatest node in
144 if self.root.key <= key:
145 return self.root
147 tmp = self.root
148 self.root = self.root.left
150 self.root = tmp
156 nodes_to_visit = [self.root]
187 current = self.root
226 self.root = current