Quick Sort Code

By | May 24, 2014

Quick Sort belongs to the category ofdivide and conquer algorithms. Quicksort  divides a large list into two smaller lists around a selected pivot . Quicksort can then recursively sort the sub-lists.It sorts the elements inplace.

The steps followed are are:

  1. Select an element, called a pivot, from the list.
  2. 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 . After this partitioning, the pivot is in its final position. This is called the partition operation.
  3. Recursively apply the above steps to the two sub-lists generated.

 For more information on bubble sort visit http://en.wikipedia.org/wiki/Quicksort.

Below is the java code for quick sort algorithm.
CODE:

Leave a Reply

Your email address will not be published. Required fields are marked *