static void Main(string[] args) { Console.WriteLine(Háromszög.IsTriFound(input)); Console.WriteLine(Háromszög.IsTriFound(input2)); //SingleRunPerfTest(); Console.Write("Done. Press [enter] to exit."); Console.Read(); }
private static void SingleRunPerfTest() { var start = DateTime.Now; var data = new List <int>(); var rndGen = new Random(); var tmp = 0; for (int i = 0; i < 30000; i++) { tmp += rndGen.Next(1, 10); data.Add(tmp); } LogTime(ref start); Console.WriteLine($"Found {Háromszög.CountTri1(data.ToArray())} tris with O(n3)"); LogTime(ref start); Console.WriteLine($"Found {Háromszög.CountTri2(data.ToArray())} tris with optimized O(n3)"); LogTime(ref start); }
public static void SrcThird(int a, int b) { Console.WriteLine($"Set {a}, {b}:"); var min = Math.Min(a, b); var max = Math.Max(a, b); var tempNum = 0; Console.Write($"-->"); for (int i = min - min; i < max + max; i++) { if (Háromszög.CheckConstraints(a, i, b)) { Console.Write($" {i},"); } tempNum = i; } Console.WriteLine(); Console.WriteLine($"||Start :{min-min} Last {tempNum}"); Console.WriteLine(); }