Skip to content

Instantly share code, notes, and snippets.

@pvcodes-zz
pvcodes-zz / .babelrc
Last active June 20, 2021 14:58
CRUD for firebase in Node.JS
{
"presets": [
["env", {
"targets": {
"node": "6.10"
}
}]
]
}
@pvcodes-zz
pvcodes-zz / shell_Sort.cpp
Created April 8, 2021 16:17
Shell Sort C++ Implementation
#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];
@pvcodes-zz
pvcodes-zz / merge_Sort.cpp
Created April 8, 2021 11:59
Merge Sort, both Iterative and Recursive
#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++];
@pvcodes-zz
pvcodes-zz / quick_Sort.cpp
Last active April 8, 2021 11:42
Quick Sort Implementation
#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;