21 for (idx1 = 0; idx1 < (n-1); idx1++) {
23 for (idx2 = 0; idx2 < (n-idx1-1); idx2++) {
42 int start_idx, min_idx, idx;
45 for (start_idx = 0; start_idx < n; start_idx++) {
48 for (idx = min_idx+1; idx < n; idx++) {
72 for (pos = 1; pos < n; pos++) {
79 op->
swap_idx(a, nxt_pos, nxt_pos - 1);
100 for (
int green = lo; green <= (hi - 1); green++) {
124 int top, *
stack, lo, hi, pivot;
150 if ((pivot - 1) > lo) {
152 stack[++top] = pivot - 1;
157 if ((pivot + 1) < hi) {
158 stack[++top] = pivot + 1;
void insertion_sort(t_gen a, int n, t_dparams *op)
Insertion sort builds the final sorted array one item at a time. It has an O(n2) time complexity
void quick_sort(t_gen a, int n, t_dparams *op)
Quicksort is an in-place sorting algorithm is a divide and conquer algorithm which relies on a partit...
int quick_sort_partition(t_gen a, int lo, int hi, t_dparams *op)
Util function to be used by quick sort for sorting partitions
void selection_sort(t_gen a, int n, t_dparams *op)
Selection sort is an in-place comparison sorting algorithm. It has an O(n2) time complexity
void bubble_sort(t_gen a, int n, t_dparams *op)
Bubble sort is simplest sorting algorithm that works by repeatedly swapping the adjacent elements if ...
Contains declations of array operations and structure.
#define free_mem(mem_addr)
#define get_mem(nmemb, size)
f_swp_idx swap_idx
Routine used for swapring elems in given array indicies.
f_cmp_idx cmpr_idx
Routine used for comparing elems in given array indicies.
void * t_gen
Base Data type used for all data structure and data elements.