pelib  2.0.0
src/sort.c File Reference
#include <assert.h>
#include <pelib/sort.h>
#include <pelib/structure.h>
#include <pelib/stack.h>
#include <pelib/stack.c>
Include dependency graph for sort.c:

Go to the source code of this file.

Classes

struct  qsort_param
struct  qsort_next_step
struct  qsort_bound

Defines

#define STRUCT_T   qsort_bound_t
#define STACK_T   qsort_bound_t
#define STACK_T   qsort_bound_t

Typedefs

typedef struct qsort_param qsort_param_t
typedef struct qsort_next_step qsort_next_step_t
typedef struct qsort_bound qsort_bound_t

Functions

int pelib_copy() qsort_bound_t (qsort_bound_t s, qsort_bound_t *d)
int pelib_init() qsort_bound_t (qsort_bound_t *d)
void pelib_insertsort_window (array_t(int)*array, int start, int stop)
void pelib_insertsort (array_t(int)*array)
int pelib_sample (array_t(int)*array, int ratio, int start, int stop)
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 start, int stop)
void pelib_quicksort (array_t(int)*array)
int pelib_mergesort (array_t(int)*array)
int pelib_is_increasing (array_t(int)*array)

Define Documentation

#define STACK_T   qsort_bound_t

Definition at line 67 of file sort.c.

#define STACK_T   qsort_bound_t

Definition at line 67 of file sort.c.

#define STRUCT_T   qsort_bound_t

Definition at line 61 of file sort.c.


Typedef Documentation

typedef struct qsort_bound qsort_bound_t

Definition at line 58 of file sort.c.

Definition at line 52 of file sort.c.

typedef struct qsort_param qsort_param_t

Definition at line 45 of file sort.c.


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.

Definition at line 416 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.

Definition at line 72 of file sort.c.

Definition at line 81 of file sort.c.