algorithm

Functions: max, min, swap, sort

max

T max<T: Copyable + Comparable>(T a, T b)

Gives the maximum of the two elements. T must also be Comparable.

T* max<T>(T* a, T* b)

Gives a pointer to the maximum of the two elements.

min

T min<T: Copyable + Comparable>(T a, T b)

Gives the minimum of the two elements. T must also be Comparable.

T* min<T>(T* a, T* b)

Gives a pointer to the minimum of the two elements.

swap

void swap<E>(E* a, E* b)

Swaps two items in place. Takes pointers because it mutates its arguments.

sort

void sort<E: Comparable>(List<E>& array)

Sorts a array. Uses insertion sort if the array is small enough, and quickSort otherwise.