Exemple #1
0
        private void subRBT(Binary_Tree.RB_Tree.NodeRB rb)
        {
            if (rb == null)
            {
                return;
            }
            string x = string.Format("Key:{0} Count:{1} Color:{2}", rb.Key, rb.Sum, rb.Color);

            rbt_treeView.Nodes.Add(x, x);
            if (rb.Left != null)
            {
                sub(rb.Left, ref rbt_treeView, x);
            }
            if (rb.Right != null)
            {
                sub(rb.Right, ref rbt_treeView, x);
            }
        }
Exemple #2
0
        private void sub(Binary_Tree.RB_Tree.NodeRB rb_node, ref TreeView nodeTV, string x)
        {
            string x2 = string.Format("Key:{0} Count:{1} Color:{2}", rb_node.Key, rb_node.Sum, rb_node.Color);

            TreeNode[] newN = nodeTV.Nodes.Find(x, true);
            newN[0].Nodes.Add(new TreeNode {
                Name = x2, Text = x2
            });

            if (rb_node.Left != null)
            {
                sub(rb_node.Left, ref nodeTV, x2);
            }

            if (rb_node.Right != null)
            {
                sub(rb_node.Right, ref nodeTV, x2);
            }
        }