// replaceParent replaces x's parent with y
replaceParent replaces x's parent with y
// replaceParent replaces x ' s parent with y
func (ivt *intervalTree) replaceParent(x *intervalNode, y *intervalNode) {
	y.parent = x.parent
	if x.parent == ivt.nilNode {
		ivt.root = y
	} else {
		if x == x.parent.left {
			x.parent.left = y
		} else {
			x.parent.right = y
		}
		x.parent.updateMax(ivt.nilNode)
	}
	x.parent = y
}
func ( ivt * intervalTree ) replaceParent ( x * intervalNode , y * intervalNode ) { y . parent = x . parent if x . parent == ivt . nilNode { ivt . root = y } else { if x == x . parent . left { x . parent . left = y } else { x . parent . right = y } x . parent . updateMax ( ivt . nilNode ) } x . parent = y }
replaceParent replaces x's parent with y
replaceParent replaces x ' s parent with y