private void Search_Click(object sender, EventArgs e)
 {
     stringBST.contain(searchBox.Text, true);
 }
예제 #2
0
 private void Search_Click(object sender, EventArgs e)
 {
     floatBST.contain(float.Parse(searchBox.Text), true);
 }
예제 #3
0
        private void Merge_Click(object sender, EventArgs e)
        {
            List <int> lst1 = new List <int>(); //the program list
            List <int> lst2 = new List <int>(); //to be filled from the file

            lst1 = intList.ToList();


            StreamReader   reader = null;
            OpenFileDialog open   = new OpenFileDialog();

            open.Title            = "Open Text File";
            open.Filter           = "TXT files|*.txt";
            open.InitialDirectory = @"C:\";
            if (open.ShowDialog() == DialogResult.OK)
            {
                using (reader = new StreamReader(open.FileName))
                {
                    opendFromFile = true;
                    OpendFilePath = open.FileName;

                    this.Invalidate();
                    this.Refresh();
                    intBST  = new BST <int>(this);
                    intList = new List <int>();
                    string line;
                    while ((line = reader.ReadLine()) != null)
                    {
                        lst2.Add(int.Parse(line));
                    }
                    reader.Close();
                }
            }

            while (true)
            {
                if (lst1.Count == 0 && lst2.Count == 0)
                {
                    break;
                }

                if (lst1.Count != 0)
                {
                    if (!intBST.contain(lst1[0], false))
                    {
                        intBST.append(lst1[0], true);
                        intList.Add(lst1[0]);
                        lst1.Remove(lst1[0]);
                    }
                    else
                    {
                        lst1.Remove(lst1[0]);
                    }
                }
                if (lst2.Count != 0)
                {
                    if (!intBST.contain(lst2[0], false))
                    {
                        intBST.append(lst2[0], true);
                        intList.Add(lst2[0]);
                        lst2.Remove(lst2[0]);
                    }
                    else
                    {
                        lst2.Remove(lst2[0]);
                    }
                }
            }
        }