Пример #1
0
        public void Insert( int data )
        {
            RedBlackTreeNode node = new RedBlackTreeNode( data );

            //case 1
            if (Root == null)
            {
                _root = node;
                node.IsBlack = true;

                return;
            }

            RedBlackTreeNode currentNode = _root;

            while (true)
            {
                if (data < currentNode.Data)
                {
                    currentNode = currentNode.LeftNode;
                }

            }
        }
Пример #2
0
 public RedBlackTree()
 {
     _root = null;
 }