private void Rotale(IList <int> datas) { var tree = new RedBlackTree <int>(); tree.Create(datas); foreach (var data in datas) { var node = tree.Search(tree.Root, data); if (!node.Right.IsEmpty()) { tree.LeftRotate(node); tree.CheckNodeParent(); } } foreach (var data in datas) { var node = tree.Search(tree.Root, data); if (!node.Left.IsEmpty()) { tree.RightRotate(node); } tree.CheckNodeParent(); } }
public static void CheckRedBlackTree(this RedBlackTree <int> tree) { CheckRoot(tree); CheckRedNode(tree); tree.CheckNodeParent(); }