Skip to content
This repository was archived by the owner on Dec 29, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added QuickSort
Binary file not shown.
20 changes: 15 additions & 5 deletions QuickSort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,21 @@ int partition (int arr[], int low, int high){
}

void quickSort(int arr[], int low, int high){
if (low < high){
int pi = partition(arr, low, high);
quickSort(arr, low, pi - 1);
quickSort(arr, pi + 1, high);
}
int pa;
while(low < high)
{
pa = partition(arr, low, high);
if(pa - 1 < high - pa) //recurse into the smaller halve
{
quickSort(arr, low, pa - 1);
low = pa + 1;
}
else{
quickSort(arr, pa + 1, high);
high = pa - 1;
}
}

}

void printArray(int arr[], int size){
Expand Down
Binary file added QuickSort.o
Binary file not shown.