C# program to sort an array using quick sort
All Answers
total answers (1)
Severity: 8192
Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
Filename: libraries/Filtered_db.php
Line Number: 23
total answers (1)
Program:
The source code to sort an integer array using quick sort is given below. The given program is compiled and executed successfully on Microsoft Visual Studio.
Output:
Explanation:
In the above program, we created a class Sort that contains an integer array intArray as a data member and we initialized the integer array using parameterized constructor.
Here, we implemented a method QuickSort() to sort the integer array based on QuickSort algorithm.
The Sort class also contains the Main() method, here we create an integer array and then passed to the parameterized constructor to initialized data members, then called QuickSort() method that will sort the array in the ascending order and printed the sorted array on the console screen.