Пример #1
0
        public static Struktura[] CreateArray(int size, int seed, string type, string DataType)
        {
            Struktura[] array = new Struktura[size];
            Random      rand  = new Random(seed);

            for (int i = 0; i < array.Length; i++)
            {
                Struktura obj = new Struktura();
                obj.value1 = rand.Next(200000);
                obj.value2 = rand.Next(200000);
                array[i]   = obj;
            }
            return(array);
        }
Пример #2
0
        private static int Partition(Struktura[] arr, int start, int end)
        {
            Struktura temp;
            Struktura p = arr[end];
            int       i = start - 1;

            for (int j = start; j <= end - 1; j++)
            {
                if (arr[j].CompareTo(p) < 0)
                {
                    i++;
                    temp   = arr[i];
                    arr[i] = arr[j];
                    arr[j] = temp;
                }
            }

            temp       = arr[i + 1];
            arr[i + 1] = arr[end];
            arr[end]   = temp;
            return(i + 1);
        }