QuickSort is a divide and conquer algorith. It picks an element as a pivot and partition the given array around the picked pivot.
This key process in quickSort is partion(). Target of partion is, given an array and an element of array x as pivot, put x at its correct position in sorted array and put all smaller elements (smaller than x) before x, and put all greater elements (greater than x) after x. All this should be done in linear time.
#include <iostream> #include <algorithm> using namespace std;