From def4ff7a545d8cba7009747a7ae1dee053e34b0a Mon Sep 17 00:00:00 2001 From: Anup Kumar Panwar Date: Tue, 6 Sep 2016 14:25:19 +0530 Subject: [PATCH] Quick Sort --- Quick Sort.cpp | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 Quick Sort.cpp diff --git a/Quick Sort.cpp b/Quick Sort.cpp new file mode 100644 index 000000000..b2bb21a77 --- /dev/null +++ b/Quick Sort.cpp @@ -0,0 +1,69 @@ +/* C implementation QuickSort */ +#include +using namespace std; + +int partition (int arr[], int low, int high) +{ + int pivot = arr[high]; // pivot + int i = (low - 1); // Index of smaller element + + for (int j = low; j >size; + + int arr[size]; + + cout<<"\nEnter the unsorted elements : "; + + for (int i = 0; i < size; ++i) + { + cout<<"\n"; + cin>>arr[i]; + } + quickSort(arr, 0, size); + cout<<"Sorted array\n"; + show(arr, size); + return 0; +}