Example #1
0
 static internal void Clear(Queue1 q) // Инкапсулированное обнуление для соответствия АТД
 {
     q.storage      = new int[0];
     q.head_pos_cur = 0;
     q.head_pos_max = 0;
     q.size         = 0;
 }
Example #2
0
 static void AddNrandoms(Queue1 q, int count)
 {
     for (int i = 0; i < count; i++)
     {
         q.AddLast(rnd.Next(1, 100));
     }
 }
Example #3
0
        static void Main(string[] args)
        {
            foreach (int N in new int[] { 3400, 60000, 120000, 240000, 480000, 960000, 1920000, 3840000 })
            {
                N_op = 0;
                Queue1 qu = new Queue1(N);
                AddNrandoms(qu, N);

                DateTime before = DateTime.Now;
                Queue1.StartQSort(ref qu);
                double time = (DateTime.Now - before).TotalMilliseconds;

                Console.WriteLine($"N: {N}    TotalMilliseconds: {time}    N_ops:{N_op}");
            }
        }
Example #4
0
 // Sorting block
 static internal void StartQSort(ref Queue1 ex) // Метод для запуска сортировки
 {
     Program.N_op += 1;
     QSort(ex.ToArray());
 }