Quicksort in C Programming Language

Quicksort is a well-known sorting algorithm developed by C.A.R. Hoare: Quicksort. Computer Journal, Vol. 5, 1, 10-15 (1962). Quicksort is said to be the fastest sorting algorithm in practice. On average it makes Θ(nlogn) (big O notation) comparisons to sort n items, but in the worst cases it isas slow as bubble sort. Visually you can see below that how quicksort works (divide and conquer strategy).

Quick Sort Demo

Here I am going to demonstrate a simple Quicksort demo. I have run and tested this on Dev C++ version 4.9.

The video below (Jon Bently) describes three different implementations of Hoare's classic Quicksort algorithm.You can find this implementation and discussion on quicksort in (Andy Oram and Greg Wilson's) book Beautiful Code: Leading Programmers Explain How They Think. under chapter three "The most beautiful code I never wrote".

Leave a Reply