MOAL.algorithms.sorting package

Submodules

MOAL.algorithms.sorting.bogo_sort module

MOAL.algorithms.sorting.bogo_sort.bogo_sort(items)[source]

MOAL.algorithms.sorting.bubble_sort module

MOAL.algorithms.sorting.bubble_sort.bubble_sort(items)[source]

MOAL.algorithms.sorting.insertion_sort module

MOAL.algorithms.sorting.insertion_sort.insertion_sort(items)[source]

MOAL.algorithms.sorting.merge_sort module

MOAL.algorithms.sorting.merge_sort.merge(left, right)[source]
MOAL.algorithms.sorting.merge_sort.merge_sort(items, iteration=0, side=None)[source]
MOAL.algorithms.sorting.merge_sort.random() → x in the interval [0, 1).

MOAL.algorithms.sorting.quick_sort module

MOAL.algorithms.sorting.quick_sort.quick_sort(items, low=None, high=None)[source]

MOAL.algorithms.sorting.selection_sort module

MOAL.algorithms.sorting.selection_sort.selection_sort(items)[source]

MOAL.algorithms.sorting.shell_sort module

MOAL.algorithms.sorting.shell_sort.shell_sort(items, maxgaps=5)[source]

Shell sort is described as a generalization of insertion and quick sort, so we use the gap strategy to divide the list into sub groups that are then sorted using traditional sorts.

MOAL.algorithms.sorting.threaded_sort module

class MOAL.algorithms.sorting.threaded_sort.ThreadSort(sorting_func, threads=2)[source]

An experiment to divide a list of items up into sub-groups and then sort them individually on different threads. Doesn’t really perform better than the original algorithm, though it could be useful for processing individual lists separately.

__init__(sorting_func, threads=2)[source]
_disperse()[source]
_enqueue(items)[source]
_worker(sorted_items=None)[source]
run(items)[source]