}//end-test-case /// <summary> /// Helper function to calculate the Maximum Height /// </summary> private static int GetMaxHeight <TKey, TValue>(RedBlackTreeMapNode <TKey, TValue> tree) where TKey : IComparable <TKey> { if (tree == null) { return(0); } return(1 + Math.Max(GetMaxHeight(tree.LeftChild), GetMaxHeight(tree.RightChild))); }
public RedBlackTreeMapNode(TKey key, TValue value, int height, RedBlackTreeMapNode <TKey, TValue> parent, RedBlackTreeMapNode <TKey, TValue> left, RedBlackTreeMapNode <TKey, TValue> right) { Key = key; Value = value; Color = RedBlackTreeColors.Red; Parent = parent; LeftChild = left; RightChild = right; }