A simple QuickSort Program in Java

Introduction to Quick Sort

QuickSort algorithm is based on the Divide and Conquer Approach.

For a given sequence S there are 4 basic steps involved:

  • Pick a number X from S. This program picks the last element.
  • Create two Lists. One list will store elements less than X and the other will store greater than X.
  • Sort the two lists recursively.
  • Combine the left list elements with X and the right list elements.

The program below sorts a sequence of Integers. After which another version has been provided which can be used to sort a sequence of characters.These are my own versions of the QuickSort Algorithm.

Continue reading “A simple QuickSort Program in Java”