Function comp_sci::algorithms::insertion_sort::insertion_sort [-]  [+] [src]

pub fn insertion_sort<'a, A: Ord + 'a>(data: &'a mut [A])

Efficient sorting against small or already sorted sets.

Insertion sort is inefficient against large sets. It requires no additional memory and is stable.

It is efficient against already substantially sorted sets (O(nk) when each element is no more than k places away from its sorted position).

Insertion sort can also sort sets as it receives them.