A sorting algorithm puts elements in an array or a list into sorted order, either in increasing or decreasing order. Most sorting algorithms work by making comparisons between two elements.
There exist many excellent resources on sorting algorithms, both for beginner as well as expert programmers. Mergesort and Quicksort are two well-known recursive sorting algorithms. The way they make recursive calls and merge the returned sorted sequence represents how many other recursive algorithms work. Below are related sites:
Mergesort
- http://en.wikipedia.org/wiki/Merge_sort
- Mergesort in Python: http://rosettacode.org/wiki/Sorting_algorithms/Merge_sort#Python
Quicksort
- http://en.wikipedia.org/wiki/Quicksort
- Quick sort in Python http://rosettacode.org/wiki/Quicksort#Python
- Visualization of Quick sort https://www.youtube.com/watch?v=aXXWXz5rF64
- Merge Sort vs Quick Sort https://www.youtube.com/watch?v=es2T6KY45cA
Advanced Reading
- Sorting Algorithm Animations http://www.sorting-algorithms.com/. This site provides visualizations for 8 different sorting algorithms on 4 different initial conditions.