C Everything
This is a C repository containing a curated set of generic data structures and algorithm.
|
Contains declations of array operations and structure. More...
#include "common.h"
Go to the source code of this file.
Functions | |
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 they are in wrong order It has an O(n2) time complexity More... | |
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 More... | |
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 More... | |
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 partition operation: to partition an array, an element called a pivot is selected. All elements smaller than the pivot are moved before it and all greater elements are moved after it. This can be done efficiently in linear time and in-place. Worst case complexity of O(n2) and average of O(nlogn) More... | |
void | merge_sort (t_gen a, int n, t_dparams *op) |
Contains declations of array operations and structure.
Definition in file array.h.
Bubble sort is simplest sorting algorithm that works by repeatedly swapping the adjacent elements if they are in wrong order It has an O(n2) time complexity
a | - Pointer to array |
n | - size of array |
op | - Data type specific params for operation such as compare and swap |
Quicksort is an in-place sorting algorithm is a divide and conquer algorithm which relies on a partition operation: to partition an array, an element called a pivot is selected. All elements smaller than the pivot are moved before it and all greater elements are moved after it. This can be done efficiently in linear time and in-place. Worst case complexity of O(n2) and average of O(nlogn)
a | - Pointer to array |
n | - size of array |
op | - Data type specific params for operation such as compare and swap |