Beispiel #1
0
        static (int, long, TimeSpan, bool) test_stack(int _len)
        {
            MyStack.N_op = 0;
            int max = _len;

            int[] sh_ar = get_shuffled_array(_len, max);


            //long ellapledTicks = DateTime.Now.Ticks;
            TimeSpan Time1 = DateTime.Now.TimeOfDay;



            MyStack stack = new MyStack(_len);

            for (int i = 0; i < sh_ar.Length; i++)
            {
                stack.Add(sh_ar[i]);
            }


            stack.quicksort(0, stack.TopPointer - 1);


            //ellapledTicks = DateTime.Now.Ticks - ellapledTicks;
            TimeSpan Time2       = DateTime.Now.TimeOfDay;
            TimeSpan time_result = Time2 - Time1;

            long N_op    = MyStack.N_op;
            bool success = is_stack_sorted(stack.GetCopy());

            return(_len, N_op, time_result, success);
        }