a mirror symmetry rotation of the leftrotation
(node)
| 87 | return ret |
| 88 | |
| 89 | def rightrotation(node): |
| 90 | ''' |
| 91 | a mirror symmetry rotation of the leftrotation |
| 92 | ''' |
| 93 | print("right rotation node:",node.getdata()) |
| 94 | ret = node.getright() |
| 95 | node.setright(ret.getleft()) |
| 96 | ret.setleft(node) |
| 97 | h1 = my_max(getheight(node.getright()),getheight(node.getleft())) + 1 |
| 98 | node.setheight(h1) |
| 99 | h2 = my_max(getheight(ret.getright()),getheight(ret.getleft())) + 1 |
| 100 | ret.setheight(h2) |
| 101 | return ret |
| 102 | |
| 103 | def rlrotation(node): |
| 104 | r''' |
no test coverage detected