コード例 #1
0
        public int[] GenerateDistinctYears(int[] years, int repetition, out long executionTime)
        {
            Stopwatch    watch         = new Stopwatch();
            DistinctYear distinctYear  = new DistinctYear();
            int          numberOfYears = years.Length;

            int[] returnedYears = new int[numberOfYears];

            //Find the next year and asign the result in the outputArray
            watch.Start();
            for (int j = 0; j < repetition; j++)
            {
                if (j != 0)
                {
                    for (int i = 0; i < numberOfYears; i++)
                    {
                        distinctYear.FindNext(years[i]);
                    }
                }
                else
                {
                    for (int i = 0; i < numberOfYears; i++)
                    {
                        returnedYears[i] = distinctYear.FindNext(years[i]);
                    }
                }
            }
            watch.Stop();


            executionTime = watch.ElapsedMilliseconds;

            return(returnedYears);
        }
コード例 #2
0
ファイル: MainMenu.cs プロジェクト: Evangelos-Ks/DistinctYear
 //============================================ Constructor =========================================================
 public MainMenu()
 {
     check        = new Check();
     distinctYear = new DistinctYear();
     watch        = new Stopwatch();
     random       = new Random();
     generate     = new Generate();
 }