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 <bits/stdc++.h> | |
using namespace std; | |
/*this function: last element as pivot then places all smaller elements to the left, the others to the right*/ | |
int partitioN(int a[], int low, int high){ | |
int pivot = a[high]; // this is pivot | |
int i = (low - 1); // index of smaller elements | |
for(int j = low; j <= high - 1; j++){ |