MCPcopy
hub / github.com/kunal-kushwaha/DSA-Bootcamp-Java / rightRotate

Method rightRotate

lectures/20-trees/code/AVL/AVL.java:86–97  ·  view source on GitHub ↗
(Node p)

Source from the content-addressed store, hash-verified

84 }
85
86 public Node rightRotate(Node p) {
87 Node c = p.left;
88 Node t = c.right;
89
90 c.right = p;
91 p.left = t;
92
93 p.height = Math.max(height(p.left), height(p.right) + 1);
94 c.height = Math.max(height(c.left), height(c.right) + 1);
95
96 return c;
97 }
98
99 public Node leftRotate(Node c) {
100 Node p = c.right;

Callers 1

rotateMethod · 0.95

Calls 2

heightMethod · 0.95
maxMethod · 0.45

Tested by

no test coverage detected