C# – First steps with C# and .NET – part 055.

By | 05/09/2022

Quicksort is an in-place sorting algorithm. Developed by British computer scientist Tony Hoare in 1959 and published in 1961, it is still a commonly used algorithm for sorting. When implemented well, it can be somewhat faster than merge sort and about two or three times faster than heapsort. see the Wikipedia article.
The solution of this algorithm can be found on the web and I add it because I want to have it here.
I add some comments for a better understanding of this algorithm.
You can test this algorithm with a matrix with distinct numbers, otherwise, it blocks with the error: Fatal Error: Execution time limit was exceeded
Let’s see the source code:

The result of this program is:

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.