Untitled

mail@pastecode.io avatar
unknown
csharp
a year ago
760 B
0
Indexable
Never
using System;
using System.Threading.Tasks;

class Program {
    static void Main(string[] args) {
        int[] array = new int[10000000]; // create a large array of integers
        Random random = new Random();
        for (int i = 0; i < array.Length; i++) {
            array[i] = random.Next(10000000); // fill the array with random integers
        }

        // use multiple threads to sort the array
        Parallel.Invoke(() => Array.Sort(array, 0, array.Length / 2),
                        () => Array.Sort(array, array.Length / 2, array.Length - array.Length / 2),
                        () => Array.Sort(array, 0, array.Length));

        Console.WriteLine("Array sorted successfully.");
        Console.ReadLine();
    }
}