Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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();
        }