Skip to content

Instantly share code, notes, and snippets.

@piyush01123
piyush01123 / quickSort.cpp
Last active February 17, 2023 19:01
QuickSort implementation
#include <bits/stdc++.h>
using namespace std;
int randGen (int i) {srand(time(0)); return rand()%i;}
int ctr = 0;
int partition(int A[], int lo, int hi)
{
int pivot = A[hi];
int i = lo-1;
@piyush01123
piyush01123 / quickSelect.cpp
Last active February 17, 2023 19:02
QuickSelect implementation
#include <bits/stdc++.h>
using namespace std;
int randGen (int i) {srand(time(0)); return rand()%i;}
int partition(int A[], int lo, int hi)
{
int pivot = A[hi];
int i = lo-1;
for (int j=lo; j<=hi; j++)