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

Function leftRotate

Trees/avltree.c:56–68  ·  view source on GitHub ↗

Left rotate

Source from the content-addressed store, hash-verified

54
55// Left rotate
56struct Node *leftRotate(struct Node *x)
57{
58 struct Node *y = x->right;
59 struct Node *T2 = y->left;
60
61 y->left = x;
62 x->right = T2;
63
64 x->height = max(height(x->left), height(x->right)) + 1;
65 y->height = max(height(y->left), height(y->right)) + 1;
66
67 return y;
68}
69
70// Get the balance factor
71int getBalance(struct Node *N)

Callers 2

insertNodeFunction · 0.85
deleteNodeFunction · 0.85

Calls 2

maxFunction · 0.70
heightFunction · 0.70

Tested by

no test coverage detected