Function insertion_sort

Function Documentation

void insertion_sort(void *arr, size_t n_elts, size_t elt_size, int (*cmpe)(const void *const e1, const void *const e2))

Sort an array using insertion sort.

Parameters:
  • arr – The array to sort

  • n_elts – # elements in the array (must be >=3)

  • elt_size – Size of elements in the array in bytes

  • cmpe – Comparison function for elements