コード例 #1
0
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            if (textBox1.Text == "" || textBox1.Text.Length > 1)
            {
                return;
            }

            if (ad == null)
            {
                ad = new adabtive(textBox1.Text[0]);
            }
            else
            {
                ad.insertnew(textBox1.Text[0]);
            }

            the_tree     = ad.root;
            label1.Text += textBox1.Text[0];
            //node temp = ad.root;

            int depth = 1;

            totalNodes = 0;
            InorderTraversal(the_tree, depth);

            maxTreeHeight = TreeHeight(the_tree);

            panel1.Invalidate();
            textBox1.Text = "";
        }
コード例 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            ad          = null;
            the_tree    = null;
            label1.Text = "";

            int depth = 1;

            totalNodes = 0;
            InorderTraversal(the_tree, depth);

            maxTreeHeight = TreeHeight(the_tree);

            panel1.Invalidate();
            textBox1.Text = "";
        }