MCPcopy Create free account
hub / github.com/subbarayudu-j/TheAlgorithms-Python / rightrotation

Function rightrotation

data_structures/binary tree/AVLtree.py:89–101  ·  view source on GitHub ↗

a mirror symmetry rotation of the leftrotation

(node)

Source from the content-addressed store, hash-verified

87 return ret
88
89def 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
103def rlrotation(node):
104 r'''

Callers 4

rlrotationFunction · 0.85
lrrotationFunction · 0.85
insert_nodeFunction · 0.85
del_nodeFunction · 0.85

Calls 8

my_maxFunction · 0.85
getheightFunction · 0.85
getdataMethod · 0.80
getrightMethod · 0.80
setrightMethod · 0.80
getleftMethod · 0.80
setleftMethod · 0.80
setheightMethod · 0.80

Tested by

no test coverage detected