libGimbal 0.1.0
C17-Based Extended Standard Library and Cross-Language Runtime Framework
Loading...
Searching...
No Matches
gimbal_sort.h File Reference

Go to the source code of this file.

Typedefs

typedef int(* GblSortComparatorFn) (const void *, const void *)
 
typedef void(* GblSortFn) (void *, size_t, size_t, GblSortComparatorFn)
 

Functions

void gblSortSelection (void *pArray, size_t count, size_t elemSize, GblSortComparatorFn pFnCmp)
 
void gblSortQuick (void *pArray, size_t count, size_t elemSize, GblSortComparatorFn pFnCmp)
 
void gblSortInsertion (void *pArray, size_t count, size_t elemSize, GblSortComparatorFn pFnCmp)
 
void gblSortShell (void *pArray, size_t count, size_t elemSize, GblSortComparatorFn pFnCmp)
 
void gblSortMerge (void *pArray, size_t count, size_t elemSize, GblSortComparatorFn pFnCmp)
 
void gblSortComb (void *pArray, size_t count, size_t elemSize, GblSortComparatorFn pFnCmp)
 
void gblSortBubble (void *pArray, size_t count, size_t elemSize, GblSortComparatorFn pFnCmp)
 
void gblSortHeap (void *pArray, size_t count, size_t elemSize, GblSortComparatorFn pFnCmp)
 
size_t gblSearchBinary (void *pSrc, size_t elemSize, int l, int r, void *pDst, GblSortComparatorFn pFnCmp)
 

Detailed Description

Generialized array sorting algorithms.

This file contains a collection of sorting algorithms, each with the same function prototype so that they can be passed around generically. Each is expected to operate on an array of data, accepting a custom comparator callback.

Todo:
  • gblSortRadix()
Author
2023 Falco Girgis

Definition in file gimbal_sort.h.

Typedef Documentation

◆ GblSortComparatorFn

typedef int(* GblSortComparatorFn) (const void *, const void *)

Function taking two elements and returning their numeric difference as an integer.

Definition at line 26 of file gimbal_sort.h.

◆ GblSortFn

typedef void(* GblSortFn) (void *, size_t, size_t, GblSortComparatorFn)

Generic function pointer type for containing one of the array sorting algorithms.

Definition at line 28 of file gimbal_sort.h.

Function Documentation

◆ gblSearchBinary()

size_t gblSearchBinary ( void *  pSrc,
size_t  elemSize,
int  l,
int  r,
void *  pDst,
GblSortComparatorFn  pFnCmp 
)

Performs a Binary Search over the given array, from index l to index r, returning its position.