Quick Sort : Java Sorting Program Code

Quick sort is based on one principle divide and conquer  . Quick sort first divides the large lists into two sub smaller lists ,the low elements and the high elements .Quick sort can then recursively sort the sublists.

Read Also :   Merge Sort Java Code with Example

* Choose an element and called it as pivot , in the given list .

Reorder the list so that all elements with values less than the pivot come before the pivot, while all elements
   with values greater than the pivot come after it (equal values can go either way). After this partitioning pivot  is in  its final position. This is called the partition operation.  

* Recursively apply the above steps to the sublists of the elements with smaller values and separately the   sublists of elements with  greater values.



It is also known as partition exchange sort .Quicksort's sequential and localized memory references work with a cache .

About The Author

Subham Mittal has worked in Oracle for 3 years.
Enjoyed this post? Never miss out on future posts by subscribing JavaHungry