static void Main(string[] args) { Sums first = new Sums(new List <int> { 3, 10, 5, 17, 8, 7, 4, 4 }, 21); List <int> val = first.find(); Console.WriteLine(string.Join(",", val)); process(); //my random method works the best (Sums.cs) Standard_Sum(); Console.ReadKey(); }
static void process() //for Sum { for (int i = 0; i < 12; ++i) { List <int> now = generate(); int now2 = ran(); Console.WriteLine($"List is {string.Join(",", now)}"); Console.WriteLine($"p is {now2}"); Sums trial = new Sums(now, now2); DateTime tnow = DateTime.Now; List <int> val4 = trial.find(); //likelyhood of i being in list is very high, hence it is more dependant on how fast can computer spot i in list. if (val4 != null) { Console.WriteLine($"subset is {string.Join(",", val4)}"); } else if (val4 == null) { Console.WriteLine("Not possible"); } DateTime tnow2 = DateTime.Now; Console.WriteLine($"time taken is {tnow2.Second - tnow.Second }"); } }