// updateMax updates the maximum values for a node and its ancestors
updateMax updates the maximum values for a node and its ancestors
// updateMax updates the maximum values for a node and its ancestors
func (x *intervalNode) updateMax(nilNode *intervalNode) {
	for x != nilNode {
		oldmax := x.max
		max := x.iv.Ivl.End
		if x.left != nilNode && x.left.max.Compare(max) > 0 {
			max = x.left.max
		}
		if x.right != nilNode && x.right.max.Compare(max) > 0 {
			max = x.right.max
		}
		if oldmax.Compare(max) == 0 {
			break
		}
		x.max = max
		x = x.parent
	}
}
func ( x * intervalNode ) updateMax ( nilNode * intervalNode ) { for x != nilNode { oldmax := x . max max := x . iv . Ivl . End if x . left != nilNode && x . left . max . Compare ( max ) > 0 { max = x . left . max } if x . right != nilNode && x . right . max . Compare ( max ) > 0 { max = x . right . max } if oldmax . Compare ( max ) == 0 { break } x . max = max x = x . parent } }
updateMax updates the maximum values for a node and its ancestors
updateMax updates the maximum values for a node and its ancestors