public static RBTree.Node LastNode(this RBTree.Node node) { if (node == null) { return(null); } while (node.right != null) { node = node.right; } return(node); }
public static RBTree.Node FirstNode(this RBTree.Node node) { if (node == null) { return(null); } while (node.left != null) { node = node.left; } return(node); }
private bool MergeSplit(ref RBTree higher, ref RBTree lower) { RBTree.Node[] array = new RBTree.Node[higher.Count + lower.Count]; lower.CopySorted(array, 0); higher.CopySorted(array, lower.Count); if (array.Length > upperLimit) { lower = RBUtils.FromSortedList(array, 0, array.Length >> 1); higher = RBUtils.FromSortedList(array, (array.Length >> 1) + 1, array.Length - 1); return(true); } else { higher = RBUtils.FromSortedList(array, 0, array.Length - 1); return(false); } }
public static RBTree.Node[] ToSortedArray(this RBTree tree) { RBTree.Node[] array = new RBTree.Node[tree.Count]; CopySorted(tree, array, 0); return(array); }
public int Compare(uint key, RBTree.Node node) { return(key.CompareTo(((RBUIntNode)node).key)); }