-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquick_sort.cpp
More file actions
44 lines (28 loc) · 815 Bytes
/
quick_sort.cpp
File metadata and controls
44 lines (28 loc) · 815 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//
// quick_sort.cpp
// DataStructures
//
// Created by Suraj on 07/06/20.
// Copyright © 2020 Suraj. All rights reserved.
// select any element as pivot and find its sorted position such that element to its left are lesser and elements to right of pivot are higher
// best case (n log n) when partioned at exact centre
// worst case (n^2) when pivot at any of the ends of list
#include <iostream>
using namespace std;
int partition()
{
}
int main()
{
int size;
cout << "Enter the number of elements: ";
cin >> size;
int arr[size];
cout << "Enter elements:" << endl;
for(int i = 0; i<size; i++)
{
cin >> arr[i];
}
cout << "Array before Sorting: " << endl;
display(arr, size);
}