//public int SumToMaxInTree(int current, int max) //{ //} public List <NumberNode> GetAll() { List <NumberNode> nodes = new List <NumberNode>(); nodes.Add(this); if (Smaller != null) { nodes.AddRange(Smaller.GetAll()); } if (Bigger != null) { nodes.AddRange(Bigger.GetAll()); } return(nodes); }
private void calc() { StringReader reader = new StringReader(textBox1.Text.Replace(" ", "").Replace("\t", "").Replace("\r", "").Replace("\n", "")); List <int> list = reader.ParseIntArray().ToList(); root = new NumberNode(list[0]); for (int i = 1; i < list.Count; i++) { root.Insert(list[i]); } root.SumToMax(0, (int)numericUpDown1.Value); string file = "lolTOURINGBILD" + new Random().Next() + ".jpg"; GraphPlotter.GraphPlott.PlottToFile(root.GetAll(), file, 1000, false); pictureBox1.Image = Image.FromFile(file); }