|
C Fundamentals
Algorithms · data structures · cryptography · systems — pure C11, zero deps
|
Bubble sort with early-exit optimization. More...
Go to the source code of this file.
Functions | |
| void | bubble_sort_ints (int *arr, size_t n) |
| void | bubble_sort_strings (char **arr, size_t n) |
Bubble sort with early-exit optimization.
Repeatedly walk the array, swapping adjacent out-of-order pairs. If a full pass produced no swaps the array is sorted — bail early. Stable, O(n²) worst, O(n) best.
Definition in file bubble_sort.c.
| void bubble_sort_ints | ( | int * | arr, |
| size_t | n | ||
| ) |
Definition at line 30 of file bubble_sort.c.
| void bubble_sort_strings | ( | char ** | arr, |
| size_t | n | ||
| ) |
Definition at line 14 of file bubble_sort.c.
Referenced by algo_from_name().