First Upload
This commit is contained in:
27
23 - Sort/shell.c
Normal file
27
23 - Sort/shell.c
Normal file
@@ -0,0 +1,27 @@
|
||||
#include "General.h"
|
||||
|
||||
void ShellSort(int * arr, int size, void Swap(int * num1, int * num2))
|
||||
{
|
||||
int gap;
|
||||
int temp;
|
||||
unsigned int counter;
|
||||
if (size != ONE) // fix
|
||||
{
|
||||
gap = size / TWO;
|
||||
temp = arr[gap];
|
||||
for (counter = ZERO; counter < gap; counter += TWO)
|
||||
{
|
||||
if (temp < arr[counter])
|
||||
{
|
||||
Swap(&(arr[gap]), &(arr[counter]));
|
||||
}
|
||||
}
|
||||
|
||||
ShellSort(arr, size, Swap);
|
||||
}
|
||||
}
|
||||
|
||||
void main(void)
|
||||
{
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user