MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / rightRotate

Function rightRotate

Trees/avltree.c:41–53  ·  view source on GitHub ↗

Right rotate

Source from the content-addressed store, hash-verified

39
40// Right rotate
41struct Node *rightRotate(struct Node *y)
42{
43 struct Node *x = y->left;
44 struct Node *T2 = x->right;
45
46 x->right = y;
47 y->left = T2;
48
49 y->height = max(height(y->left), height(y->right)) + 1;
50 x->height = max(height(x->left), height(x->right)) + 1;
51
52 return x;
53}
54
55// Left rotate
56struct Node *leftRotate(struct Node *x)

Callers 2

insertNodeFunction · 0.85
deleteNodeFunction · 0.85

Calls 2

maxFunction · 0.70
heightFunction · 0.70

Tested by

no test coverage detected