mergesort.h 574 B

123456789101112131415161718
  1. #ifndef MERGESORT_H
  2. #define MERGESORT_H
  3. /*
  4. * Sort linked list in place.
  5. * - get_next_fn() returns the next element given an element of a linked list.
  6. * - set_next_fn() takes two elements A and B, and makes B the "next" element
  7. * of A on the list.
  8. * - compare_fn() takes two elements A and B, and returns negative, 0, positive
  9. * as the same sign as "subtracting" B from A.
  10. */
  11. void *llist_mergesort(void *list,
  12. void *(*get_next_fn)(const void *),
  13. void (*set_next_fn)(void *, void *),
  14. int (*compare_fn)(const void *, const void *));
  15. #endif