• 大小: 266.86 KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2024-09-30
  • 语言: C#
  • 标签: c#  二叉树  

资源简介

此系统设计整合了二叉树基本操作,二叉树排序,二叉树计算和文件读写四个功能。

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace TreeApp
{
    public partial class Form1 : Form
    {
        Form2 form2 = new Form2();
        Form3 form3 = new Form3();
        Form4 form4 = new Form4();
        Form5 form5 = new Form5();
        Form6 form6 = new Form6();
        Form7 form7 = new Form7();
        Tree tree = new Tree();
        public Form1()
        {
            InitializeComponent();
        }

        private void button_insert_Click(object sender EventArgs e)//插入操作
        {
            
            int key=0;
            double value=0;
            form2.ShowDialog();
            if (form2.bl==true)
            {
                key = Convert.ToInt32(form2.textBox_number.Text.ToString());
                value = Convert.ToDouble(form2.textBox_value.Text.ToString());
                tree.insert(key value);
                form2.bl = false;
            }
            
            //if(form2.button_yes.Select())
            //tree.insert(form2.textBox_number form2.textBox_value);
        }



        private void button_delete_Click(object sender EventArgs e)//删除操作
        {
            int key = 0;
            form3.ShowDialog();
            if(form3.bl==true)
            {
                key = Convert.ToInt32(form3.textBox_number.Text.ToString());
                tree.delete(key);
                listView1.Items.Clear();
                preOrder1(tree.root);
                form3.bl=false;
            }
            
            
        }

        private void button_find_Click(object sender EventArgs e)//查找操作
        {
            int key = 0;
            form4.ShowDialog();
            if ( form4.bl==true)
            {
                key = Convert.ToInt32(form4.textBox_number.Text.ToString());
                Node found= tree.find(key);
                if (found != null)
                {
                    form5.textBox_number.Text = Convert.ToString(found.iData);
                    form5.textBox_value.Text = Convert.ToString(found.dData);
                    if (form5.ShowDialog() == DialogResult.OK) ;
                }
                form4.bl = false;
            }
            
            


        }

        private void listView1_SelectedIndexChanged(object sender EventArgs e)
        {

        }

        private void button_output_Click(object sender EventArgs e)//输出操作
        {
           // System.Windows.Forms.ListViewItem listviewitem;
            listView1.Items.Clear();
            preOrder1(tree.root);
         /*   for (int i = 0; i < tree.k; i++)
            {

                String number value;
                number = Convert.ToString(tree.number[i]);
                value = Convert.ToString(tree.value[i]);
                listviewitem = new Li

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        910  2008-07-05 20:56  TreeApp\TreeApp.sln

    ..A..H.     38912  2008-11-01 08:59  TreeApp\TreeApp.suo

     文件      18053  2008-07-10 23:16  TreeApp\TreeApp\Form1.cs

     文件      16751  2008-07-08 01:36  TreeApp\TreeApp\Form1.Designer.cs

     文件       5814  2008-07-08 01:36  TreeApp\TreeApp\Form1.resx

     文件        692  2008-07-07 10:29  TreeApp\TreeApp\Form2.cs

     文件       4462  2008-07-07 10:22  TreeApp\TreeApp\Form2.Designer.cs

     文件       5814  2008-07-07 10:22  TreeApp\TreeApp\Form2.resx

     文件        481  2008-07-07 10:37  TreeApp\TreeApp\Form3.cs

     文件       3199  2008-07-07 10:37  TreeApp\TreeApp\Form3.Designer.cs

     文件       5814  2008-07-07 10:37  TreeApp\TreeApp\Form3.resx

     文件        584  2008-07-07 10:44  TreeApp\TreeApp\Form4.cs

     文件       3306  2008-07-07 10:44  TreeApp\TreeApp\Form4.Designer.cs

     文件       5814  2008-07-07 10:44  TreeApp\TreeApp\Form4.resx

     文件        425  2008-07-07 19:01  TreeApp\TreeApp\Form5.cs

     文件       4182  2008-07-07 19:01  TreeApp\TreeApp\Form5.Designer.cs

     文件       5814  2008-07-07 19:01  TreeApp\TreeApp\Form5.resx

     文件        335  2008-07-07 02:46  TreeApp\TreeApp\Form6.cs

     文件       4138  2008-07-07 02:46  TreeApp\TreeApp\Form6.Designer.cs

     文件       5814  2008-07-07 02:46  TreeApp\TreeApp\Form6.resx

     文件        335  2008-07-07 02:46  TreeApp\TreeApp\Form7.cs

     文件       2599  2008-07-07 02:46  TreeApp\TreeApp\Form7.Designer.cs

     文件       5814  2008-07-07 02:46  TreeApp\TreeApp\Form7.resx

     文件        466  2008-07-05 20:56  TreeApp\TreeApp\Program.cs

     文件       6483  2008-07-10 23:35  TreeApp\TreeApp\TreeApp.csproj

     文件        536  2008-07-10 23:35  TreeApp\TreeApp\TreeApp.csproj.user

     文件       1652  2008-07-10 23:34  TreeApp\TreeApp\TreeApp_TemporaryKey.pfx

     文件       1186  2008-07-05 20:56  TreeApp\TreeApp\Properties\AssemblyInfo.cs

     文件       2868  2008-07-05 20:56  TreeApp\TreeApp\Properties\Resources.Designer.cs

     文件       5612  2008-07-05 20:56  TreeApp\TreeApp\Properties\Resources.resx

............此处省略43个文件信息

评论

共有 条评论