(self, rotRoot)
| 108 | newRoot.balanceFactor = newRoot.balanceFactor + 1 + max(rotRoot.balanceFactor, 0) |
| 109 | |
| 110 | def rotateRight(self, rotRoot): |
| 111 | newRoot = rotRoot.leftChild |
| 112 | rotRoot.leftChild = newRoot.rightChild |
| 113 | if newRoot.rightChild != None: |
| 114 | newRoot.rightChild.parent = rotRoot |
| 115 | newRoot.parent = rotRoot.parent |
| 116 | if rotRoot.isRoot(): |
| 117 | self.root = newRoot |
| 118 | else: |
| 119 | if rotRoot.isRightChild(): |
| 120 | rotRoot.parent.rightChild = newRoot |
| 121 | else: |
| 122 | rotRoot.parent.rightChild = newRoot |
| 123 | newRoot.rightChild = rotRoot |
| 124 | rotRoot.parent = newRoot |
| 125 | rotRoot.balanceFactor = rotRoot.balanceFactor + 1 - min(newRoot.balanceFactor, 0) |
| 126 | newRoot.balanceFactor = newRoot.balanceFactor + 1 + max(rotRoot.balanceFactor, 0) |
| 127 | |
| 128 | def rebalance(self, node): |
| 129 | if node.balanceFactor < 0: |
no test coverage detected