For a long time it puzzled me how something so expensive, so leading edge, could be so useless. And then it occurred to me that a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are, in short, a perfect match. Bill Bryson
Quicksort is an efficient comparison sort algorithm compare than other sorting algorithm. It can operate in place on an array, requiring small additional amounts of memory to perform sorting.
Quicksort can be faster than merge sort and heap sort. Quicksort is one of the divide and conquer strategy algorithm. It requires careful selection of pivot element. Even if the array nearly sorted or sorted the quicksort takes the same complexity. If the array nearly sorted, we can choose insertion sort for better complexity.
Write a program to implement the quick sort.
Unsorted array before sorting: [12, 34, 56, 23, 45, 78, 46] Sorted array After Quicksort sorting: [12, 23, 34, 45, 46, 56, 78]