fix merge conflicts

This commit is contained in:
Krishna Vedala 2020-05-27 18:45:52 -04:00
parent 9249fa2743
commit 7238aa7869
No known key found for this signature in database
GPG Key ID: BA19ACF8FC8792F7

View File

@ -1,16 +1,6 @@
<<<<<<< HEAD
/* C implementation QuickSort */
#include <iostream>
int partition(int arr[], int low, int high) {
int pivot = arr[high]; // pivot
int i = (low - 1); // Index of smaller element
=======
/**
*
* copyright The Algorithms
* Author -
* Correction - ayaankhan98
* @file
* @brief Quick sort algorithm
*
* Implementation Details -
* Quick Sort is a divide and conquer algorithm. It picks and element as
@ -46,17 +36,12 @@ int partition(int arr[], int low, int high) {
int partition(int arr[], int low, int high) {
int pivot = arr[high]; // taking the last element as pivot
int i = (low - 1); // Index of smaller element
>>>>>>> major-corrections-to-files
for (int j = low; j < high; j++) {
// If current element is smaller than or
// equal to pivot
if (arr[j] <= pivot) {
<<<<<<< HEAD
i++; // increment index of smaller element
=======
i++; // increment index of smaller element
>>>>>>> major-corrections-to-files
int temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
@ -68,13 +53,6 @@ int partition(int arr[], int low, int high) {
return (i + 1);
}
<<<<<<< HEAD
void quickSort(int arr[], int low, int high) {
if (low < high) {
int p = partition(arr, low, high);
=======
/**
* The main function that implements QuickSort
* arr[] --> Array to be sorted,
@ -84,25 +62,18 @@ void quickSort(int arr[], int low, int high) {
void quickSort(int arr[], int low, int high) {
if (low < high) {
int p = partition(arr, low, high);
>>>>>>> major-corrections-to-files
quickSort(arr, low, p - 1);
quickSort(arr, p + 1, high);
}
}
<<<<<<< HEAD
void show(int arr[], int size) {
for (int i = 0; i < size; i++) std::cout << arr[i] << "\n";
=======
// prints the array after sorting
void show(int arr[], int size) {
for (int i = 0; i < size; i++)
std::cout << arr[i] << " ";
for (int i = 0; i < size; i++) std::cout << arr[i] << " ";
std::cout << "\n";
>>>>>>> major-corrections-to-files
}
// Driver program to test above functions
/** Driver program to test above functions */
int main() {
int size;
std::cout << "\nEnter the number of elements : ";