From bc4e8471ba48b057bce24990de328809336c53d2 Mon Sep 17 00:00:00 2001 From: vinay <41315212+vinaytejab@users.noreply.github.com> Date: Thu, 10 Oct 2019 17:03:53 +0530 Subject: [PATCH] Create quicksort.cpp --- quicksort.cpp | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 quicksort.cpp diff --git a/quicksort.cpp b/quicksort.cpp new file mode 100644 index 0000000..6bac91e --- /dev/null +++ b/quicksort.cpp @@ -0,0 +1,62 @@ +#include +using namespace std; +int partition(int *a,int start,int end) +{ + int pivot=a[end]; + //pivot value index + + int P_index=start; + int i,t; //t is temporary variable + + //Here we will check if array value is + //less than pivot + //then we will place it at left side + //by swapping + + for(i=start;i>n; + int a[n]; + cout<<"Enter the array elements:\n"; + for(int i=0;i>a[i]; + } + Quicksort(a,0,n-1); + cout<<"After Quick Sort the array is:\n"; + for(int i=0;i