This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"presets": [ | |
["env", { | |
"targets": { | |
"node": "6.10" | |
} | |
}] | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
void shellSort(int A[], int n) { | |
for (int gap = n / 2; gap >= 1; gap /= 2) { | |
for (int j = gap; j < n; j++) { | |
int temp = A[j]; | |
int i = j - gap; | |
while (i >= 0 && A[i] > temp) { | |
A[i + gap] = A[i]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
// this sorts, two half sorted array where index 0 to mid is sorted and mid+1 to high/last index is sorted | |
void merge(int A[], int l, int mid, int h) { | |
int i = l, j = mid + 1, k = l; | |
int B[100]; | |
while (i <= mid && j <= h) { | |
if (A[i] < A[j]) | |
B[k++] = A[i++]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
void quickSort(int *array, int low, int high) { | |
int i = low; | |
int j = high; | |
int pivot = array[(i + j) / 2]; | |
int temp; |