/// <summary>Given an item and a leaf that is known to contain a copy of /// the item, this method returns the index of the item in the tree as /// a whole. Requires O(M )</summary> protected int ReconstructIndex(T item, AListLeaf <K, T> leaf) { AListInnerBase <K, T> inner; AListNode <K, T> node; bool found; int index = leaf.IndexOf(item, 0), localIndex; if (index <= -1) { BadState(); } node = leaf; while (node != _root) { Debug.Assert(node != null); _nodes.FindLowerBoundExact(ref node, out inner, out found); if (!found) { BadState(); } if ((localIndex = (int)inner.BaseIndexOf(node)) <= -1) { BadState(); } node = inner; index += localIndex; } return(index); }