pelib  2.0.0
include/pelib/sort.h File Reference
#include <pelib/integer.h>
Include dependency graph for sort.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  qsort_tune

Defines

#define PELIB_QUICKSORT_THRESHOLD   15
#define PELIB_QUICKSORT_NUM_SAMPLE   10

Typedefs

typedef struct qsort_tune qsort_tune_t

Functions

int pelib_sample (array_t(int)*a, int size, int start, int stop)
void pelib_insertsort_window (array_t(int)*a, int begin, int end)
void pelib_insertsort (array_t(int)*)
void pelib_quicksort_tune (array_t(int)*array, qsort_tune_t p)
void pelib_quicksort_tune_recursive (array_t(int)*array, qsort_tune_t p)
void pelib_quicksort_window (array_t(int)*array, int begin, int end)
void pelib_quicksort (array_t(int)*)
int pelib_is_increasing (array_t(int)*)

Define Documentation

#define PELIB_QUICKSORT_NUM_SAMPLE   10

Definition at line 30 of file sort.h.

#define PELIB_QUICKSORT_THRESHOLD   15

Definition at line 29 of file sort.h.


Typedef Documentation

typedef struct qsort_tune qsort_tune_t

Spaceless alias for struct_qsort

Definition at line 41 of file sort.h.


Function Documentation

Run insert sort on a complete array

Definition at line 128 of file sort.c.

void pelib_insertsort_window ( array_t(int)*  a,
int  begin,
int  end 
)

Insert sort in a subset of an array

Parameters:
aArray to sort
beginIndex of the first element of the subarray to run insert sort on
endIndex of the last element of the subarray to run insert sort on

Definition at line 106 of file sort.c.

Returns 0 if an array is not in non-decreasing order

Definition at line 431 of file sort.c.

Run quicksort on a complete array

Definition at line 403 of file sort.c.

Run quicksort with tuning parameters

Definition at line 333 of file sort.c.

Run recursive version of quicksort

Definition at line 379 of file sort.c.

void pelib_quicksort_window ( array_t(int)*  array,
int  begin,
int  end 
)

Run quicksort on a subset of an array

Definition at line 390 of file sort.c.

int pelib_sample ( array_t(int)*  a,
int  size,
int  start,
int  stop 
)

Computes a pivot from a sample of an array

Parameters:
aArray to compute a pivot from
sizeNumber of elements fo pick to compute a pivot
startMinimal index from which to pick samples
stopMaximal index from which to pick samples

Definition at line 134 of file sort.c.