I just added a script which executes and gives examples of some basic sorting algorithms. Its accessible at Sorting Algorithms

Right now, the algorithms consist of BubbleSort, InsertionSort, MergeSort and SelectionSort.

**BubbleSort** works by comparing items that are next to one another. If the items are not in proper order, they are swapped. The process continues until we pass through the list without making a swap.

**InsertionSort** divides an array into two parts, a sorted part and an unsorted part. In each iteration, a new element is compared to all the elements of the sorted part of the array to find where it belongs in this subarray. The algorithm terminates when all elements have been inserted into the sorted part of the array.

**MergeSort** is based on the divide and conquer algorithm. It works by calling itself (the function mergesort) on two smaller arrays: the elements in the first half of the array, and the elements in the second half of the array.

**QuickSort** is another divide and conquer algorithm. It is based on first choosing a pivot element (we choose the middle element, but it can be any element) and ensuring that all elements that are less than the pivot element are to the left of it in the array, and all elements greater than the pivot element are to the right in the array. Then the quicksort algorithm is recursively called on each part of the array.

**SelectionSort** repeatedly finds the minimal value in the list and places it in the first (remaining) position in the (unsorted) array.