From 0db71e0fa94c1857f98890928098e8f4c8ac6f26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Sun, 1 Apr 2012 00:10:11 +0200 Subject: add mergesort() for linked lists This adds a generic bottom-up mergesort implementation for singly linked lists. It was inspired by Simon Tatham's webpage on the topic[1], but not so much by his implementation -- for no good reason, really, just a case of NIH. [1] http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- mergesort.h | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 mergesort.h (limited to 'mergesort.h') diff --git a/mergesort.h b/mergesort.h new file mode 100644 index 0000000000..d6e5f4a732 --- /dev/null +++ b/mergesort.h @@ -0,0 +1,9 @@ +#ifndef MERGESORT_H +#define MERGESORT_H + +void *mergesort(void *list, + void *(*get_next_fn)(const void *), + void (*set_next_fn)(void *, void *), + int (*compare_fn)(const void *, const void *)); + +#endif -- cgit v1.2.3