MCPcopy Create free account
hub / github.com/TheAlgorithms/Go / rightRotate

Method rightRotate

structure/tree/avl.go:341–357  ·  view source on GitHub ↗
(x *AVLNode[T])

Source from the content-addressed store, hash-verified

339}
340
341func (avl *AVL[T]) rightRotate(x *AVLNode[T]) *AVLNode[T] {
342 y := x.left
343 yr := y.right
344 y.right = x
345 x.left = yr
346
347 if yr != avl._NIL {
348 yr.parent = x
349 }
350
351 y.parent = x.parent
352 x.parent = y
353
354 x.height = avl.height(x)
355 y.height = avl.height(y)
356 return y
357}

Callers 2

pushHelperMethod · 0.95
deleteHelperMethod · 0.95

Calls 1

heightMethod · 0.95

Tested by

no test coverage detected