internal void ZigZxg() { Debug.Assert(Parent.Parent != null); if (Parent.IsLeftChild()) { ZigZxg <NoFlip>(); } else { ZigZxg <DoFlip>(); } }
private void Zig <T>() where T : FlipBase <T> { if (Parent == null) { return; } BinaryNode <TKey, TValue> parent = Parent; BinaryNode <TKey, TValue> grandParent = parent.Parent; BinaryNode <TKey, TValue> rightTree = GetRightChild <T>(); if (grandParent != null) { if (parent.IsLeftChild()) { grandParent.LeftChild = this; } else { grandParent.RightChild = this; } } Parent = grandParent; parent.SetLeftChild <T>(rightTree); SetRightChild <T>(parent); }