diff options
author | René Scharfe <rene.scharfe@lsrfire.ath.cx> | 2012-04-01 00:10:11 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-04-11 08:50:53 -0700 |
commit | 0db71e0fa94c1857f98890928098e8f4c8ac6f26 (patch) | |
tree | 0095038b4c0b0c9d643380f479cb17db1dcd14a6 /mergesort.h | |
parent | 828ea97de486c1693d6e4f2c7347acb50235a85d (diff) | |
download | git-0db71e0fa94c1857f98890928098e8f4c8ac6f26.tar.gz |
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 <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'mergesort.h')
-rw-r--r-- | mergesort.h | 9 |
1 files changed, 9 insertions, 0 deletions
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 |