MCPcopy Index your code
hub / github.com/TheAlgorithms/JavaScript / updateHeight

Function updateHeight

Data-Structures/Tree/AVLTree.js:108–113  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

106
107// update height of a node based on children's heights
108const updateHeight = function (node) {
109 if (node == null) {
110 return
111 }
112 node._height = Math.max(getHeight(node._left), getHeight(node._right)) + 1
113}
114
115// Helper: To check if the balanceFactor is valid
116const isValidBalanceFactor = (balanceFactor) =>

Callers 4

leftRotateFunction · 0.85
rightRotateFunction · 0.85
insertFunction · 0.85
deleteElementFunction · 0.85

Calls 1

getHeightFunction · 0.85

Tested by

no test coverage detected