module documentation

This module provides a variety of list sorting algorithms, to illustrate the many different algorithms (recipes) for solving a problem, and how to analyze algorithms experimentally.

Function bubble Bubble Sort: compare adjacent elements of the list left-to-right, and swap them if they are out of order. After one pass through the list swapping adjacent items, the largest item will be in the rightmost position...
Function demo Undocumented
Function merge Merge Sort: split the list in half, and sort each half, then combine the sorted halves.
Function quick Undocumented
Function selection Selection Sort: scan the list to find its smallest element, then swap it with the first element. The remainder of the list is one element smaller; apply the same method to this list, and so on.
Function _merge_lists Undocumented
Function _partition Undocumented
Function _quick Undocumented
def bubble(a): (source)

Bubble Sort: compare adjacent elements of the list left-to-right, and swap them if they are out of order. After one pass through the list swapping adjacent items, the largest item will be in the rightmost position. The remainder is one element smaller; apply the same method to this list, and so on.

def demo(): (source)

Undocumented

def merge(a): (source)

Merge Sort: split the list in half, and sort each half, then combine the sorted halves.

def quick(a): (source)

Undocumented

def selection(a): (source)

Selection Sort: scan the list to find its smallest element, then swap it with the first element. The remainder of the list is one element smaller; apply the same method to this list, and so on.

def _merge_lists(b, c): (source)

Undocumented

def _partition(a, l, r): (source)

Undocumented

def _quick(a, l, r): (source)

Undocumented