From 54888c4950912311e2cb9ef7e0a0662c2b0bdb6e Mon Sep 17 00:00:00 2001 From: vinay <41315212+vinaytejab@users.noreply.github.com> Date: Tue, 1 Oct 2019 22:21:51 +0530 Subject: [PATCH] QuickSort.cpp file --- 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..38381ad --- /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