Web Design, Development & Marketing

Web Development Articles

Java: Quick Sort Algorithm Analysis

The Quick Sort is a recursive algorithm which is very similar to the Merge Sort. It takes an element in a list and uses that element as a pivot value to divide the whole list into two parts. This division is done so that one of the parts contains elements less than the pivot. The other part contains elements that are larger than the pivot. This process is then repeated recursively on these two resultant parts. When the algorithm arrives at a single element to be sorted, nothing is done as this single element is “sorted”.

The Quick Sort has O(N log(N)) average case time complexity. If implemented so that the pivot point is always set to the first element of the current list, the worst case time complexity is of O(N2). The Quick Sort has the advantage of being a very fast algorithm but it is also very complex due to its heavy use of recursion.

Subscribe to RSS Feed Bookmark and Share

Related Links

Related Articles / Posts

Java: Quick Sort Algorithm Analysis (13/06/2006)

Java: Merge Sort Algorithm Analysis and Code (05/04/2006)

Java: Random Array Generator (29/03/2006)

Java: Insertion Sort Algorithm Analysis and Code (29/03/2006)

Java: Binary Search Algorithm Analysis and Code (29/03/2006)