Ejemplo n.º 1
0
        private void subBST(Binary_Tree.Binary_Search_Tree bst)
        {
            if (bst == null)
            {
                return;
            }
            string x = string.Format("Key:{0} Count:{1}", bst.Key, bst.kvo);

            bst_treeView.Nodes.Add(x, x);
            if (bst.Left != null)
            {
                sub(bst.Left, ref bst_treeView, x);
            }
            if (bst.Right != null)
            {
                sub(bst.Right, ref bst_treeView, x);
            }
        }
Ejemplo n.º 2
0
        private void sub(Binary_Tree.Binary_Search_Tree bst_node, ref TreeView nodeTV, string x)
        {
            string x2 = string.Format("Key:{0} Count:{1}", bst_node.Key, bst_node.kvo);

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

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

            if (bst_node.Right != null)
            {
                sub(bst_node.Right, ref nodeTV, x2);
            }
        }
Ejemplo n.º 3
0
        private void TreeView_loading()
        {
            Binary_Tree.Binary_Search_Tree bst = new Binary_Tree.Binary_Search_Tree();
            Binary_Tree.AVL_Tree           avl = new Binary_Tree.AVL_Tree();
            Binary_Tree.RB_Tree            rbt = new Binary_Tree.RB_Tree();


            int[] vs4 = { -11, 34, 43, 65, 7, 15, 0, 1, -42, 5, 0, 12, 42, -4, 1 };
            for (int i = 0; i < 15; i++)
            {
                bst.Insert(vs4[i]);
                avl.Insert(vs4[i]);
                rbt.Insert(vs4[i]);
            }

            subBST(bst);
            subAVl(avl.nodeAVL);
            subRBT(rbt.Tree);
        }