Esempio n. 1
0
 private void rec(Node <Student> current, RBTree <Student> newTree)
 {
     if (current.data.examResults[0] < 50 || current.data.examResults[1] < 50 ||
         current.data.examResults[2] < 50 || current.data.examResults[3] < 50 ||
         current.data.examResults[4] < 50)
     {
         newTree.Insert(current.key, current.data);
     }
     if (current.left != null)
     {
         rec(current.left, newTree);
     }
     if (current.right != null)
     {
         rec(current.right, newTree);
     }
 }
Esempio n. 2
0
        void LoadFromFile()
        {
            StreamReader reader = new StreamReader(File.Open("input.dat", FileMode.Open));

            tree = new RBTree <Student>();
            while (!reader.EndOfStream)
            {
                string[] strmass = reader.ReadLine().Split(' ');
                tree.Insert(Convert.ToInt32(strmass[1]), new Student(strmass[0],
                                                                     Convert.ToInt32(strmass[1]),
                                                                     Convert.ToInt32(strmass[2]),
                                                                     Convert.ToInt32(strmass[3]),
                                                                     Convert.ToInt32(strmass[4]),
                                                                     Convert.ToInt32(strmass[5]),
                                                                     Convert.ToInt32(strmass[6])));
            }
            pictureBox1.Invalidate();
        }
Esempio n. 3
0
 private void LoadRBTree(object sender, EventArgs e)
 {
     tree = new RBTree <Student>();
     LoadFromFile();
 }
Esempio n. 4
0
 private void createTree_Click(object sender, EventArgs e)
 {
     newTree = new RBTree <Student>();
     rec(tree.GetRoot, newTree);
     pictureBox2.Invalidate();
 }