private void ComputeRotationTree() { var stack = new Stack <RotationTreeNode>(); stack.Push(_minusInf.FirstChild); while (stack.Count > 0) { RotationTreeNode p = stack.Pop(); RotationTreeNode pr = p.Next; RotationTreeNode q = p.Parent; if (q != _minusInf) { HandleWithPoints(p, q); } p.Remove(); RotationTreeNode z = q.Prev; if (z == null || !LeftTurn(p, z, z.Parent)) { q.AddBefore(p); } else { while (!z.IsLeaf && LeftTurn(p, z.LastChild, z)) { z = z.LastChild; } z.AddChild(p); if (stack.Count > 0 && z == stack.Peek()) { stack.Pop(); } } if (p.Prev == null && p.Parent != _plusInf) { stack.Push(p); } if (pr != null) { stack.Push(pr); } } }