Exemplo n.º 1
0
        public m_TreeNode(int data, bool isBlack)
        {
            this.data    = data;
            this.isBlack = isBlack;
            leftNode     = null;
            rightNode    = null;

            parent = null;
        }
Exemplo n.º 2
0
        public m_TreeNode()
        {
            data      = 0;
            isBlack   = true;
            leftNode  = null;
            rightNode = null;

            parent = null;
        }
Exemplo n.º 3
0
        public m_TreeNode(int data)
        {
            this.data = data;
            isBlack   = true;
            leftNode  = null;
            rightNode = null;

            parent = null;
        }
Exemplo n.º 4
0
 TreeNode AddNode(m_TreeNode node)
 {
     if (node == null)
     {
         TreeNode newNode = new TreeNode("null");
         newNode.BackColor = Color.Black;
         return(newNode);
     }
     else
     {
         TreeNode newNode = new TreeNode(node.data.ToString());
         if (node.isBlack)
         {
             newNode.BackColor = Color.Black;
         }
         else
         {
             newNode.BackColor = Color.Red;
         }
         newNode.Nodes.Add(AddNode(node.rightNode));
         newNode.Nodes.Add(AddNode(node.leftNode));
         return(newNode);
     }
 }