gdsl  1.8
Sort module.

This module is for sorting arrays. More...

Functions

void gdsl_sort (gdsl_element_t *T, ulong N, const gdsl_compare_func_t COMP_F)
 Sort an array in place.

Detailed Description

This module is for sorting arrays.

Copyright

Copyright (C) 1998-2018 Nicolas Darnis <ndarnis@free.fr>.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.


Function Documentation

void gdsl_sort ( gdsl_element_t T,
ulong  N,
const gdsl_compare_func_t  COMP_F 
)

Sort an array in place.

Sort the array T in place. The function COMP_F is used to compare T's elements and must be user-defined.

Note:
Complexity: O( N log( N ) )
Precondition:
N == |T| & T != NULL & COMP_F != NULL & for all i <= N: sizeof (T[i]) == sizeof (gdsl_element_t)
Parameters:
TThe array of elements to sort
NThe number of elements into T
COMP_FThe function pointer used to compare T's elements
Examples:
examples/main_sort.c.