Function mergesort_rec
Defined in File sort.h
Function Documentation
-
struct llist_node *mergesort_rec(struct llist_node *list, int (*cmpe)(const void *const e1, const void *const e2), bool_t isdouble)
Sort a linked list using recursive mergesort.
This function sorts a linked list using a recursive implementation of mergesort. It has a complexity of O(NLogN). It can be used to sort any singly or doubly linked list.
- Parameters:
list – The list to sort
cmpe – A comparison function for the data managed by each node
isdouble – true if the list to be sorted is doubly linked
- Returns:
A pointer to the sorted list