private void startGreedy() { List <int> results; List <int> resources = new List <int>(resourcesN); for (int i = 0; i < resourcesN; i++) { resources.Add(0); } Greedy gr = new Greedy(resources, tasks); gr.Go(out results); results.Sort(); textBox1.AppendText("Greedy:" + results.Last <int>() + Environment.NewLine); }