Algorithms_in_C 1.0.0
Set of algorithms implemented in C.
|
Macros | |
#define | BEAD(i, j) beads[i * max + j] |
Create easy access of elements from a 2D matrix stored in memory as a 1D array. | |
Functions | |
void | display (const int *arr, int n) |
Displays the array, passed to this method. | |
void | bead_sort (int *a, size_t len) |
This is where the sorting of the array takes place. | |
void | RecursionInsertionSort (int *arr, int size) |
Insertion sort algorithm implements using Recursion. | |
void | swap (int *a, int *b) |
Swap two integer variables. | |
void | merge (int *a, int l, int r, int n) |
Perform merge of segments. | |
void | merge_sort (int *a, int n, int l, int r) |
Merge sort algorithm implementation. | |
void | show_data (int *arr, long len) |
Helper function to print array values. | |
void | shell_sort (int *array, long LEN) |
Shell sort algorithm. | |
void bead_sort | ( | int * | a, |
size_t | len | ||
) |
This is where the sorting of the array takes place.
[in,out] | a | array to be sorted |
[in] | len | Array Size |
void display | ( | const int * | arr, |
int | n | ||
) |
Displays the array, passed to this method.
[in] | arr | array to display |
[in] | n | number of elements in the array |
void merge | ( | int * | a, |
int | l, | ||
int | r, | ||
int | n | ||
) |
Perform merge of segments.
a | array to sort |
l | left index for merge |
r | right index for merge |
n | total number of elements in the array |
void merge_sort | ( | int * | a, |
int | n, | ||
int | l, | ||
int | r | ||
) |
Merge sort algorithm implementation.
a | array to sort |
n | number of elements in the array |
l | index to sort from |
r | index to sort till |
void RecursionInsertionSort | ( | int * | arr, |
int | size | ||
) |
Insertion sort algorithm implements using Recursion.
arr | array to be sorted |
size | size of array |
void shell_sort | ( | int * | array, |
long | LEN | ||
) |
Shell sort algorithm.
Optimized algorithm - takes half the time as other
[in,out] | array | array to sort |
[in] | LEN | length of the array |
void show_data | ( | int * | arr, |
long | len | ||
) |
Helper function to print array values.
|
inline |
Swap two integer variables.
Function to swap values of two integers.
[in,out] | a | pointer to first variable |
[in,out] | b | pointer to second variable |
[in,out] | a | reference to first variable |
[in,out] | b | reference to second variable |