|
C Fundamentals
Algorithms · data structures · cryptography · systems — pure C11, zero deps
|
Insertion sort — stable, O(n²) worst, O(n) on nearly-sorted input. More...
Go to the source code of this file.
Functions | |
| void | insertion_sort_ints (int *arr, size_t n) |
| void | insertion_sort_strings (char **arr, size_t n) |
Insertion sort — stable, O(n²) worst, O(n) on nearly-sorted input.
Walk the array left-to-right; for each element, slide it leftward over any larger predecessors until it lands in its sorted slot.
Definition in file insertion_sort.c.
| void insertion_sort_ints | ( | int * | arr, |
| size_t | n | ||
| ) |
Definition at line 25 of file insertion_sort.c.
Referenced by main().
| void insertion_sort_strings | ( | char ** | arr, |
| size_t | n | ||
| ) |
Definition at line 12 of file insertion_sort.c.
Referenced by algo_from_name().