mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-04-04 02:59:43 +08:00
modified comment block
This commit is contained in:
@@ -26,11 +26,14 @@
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
|
||||
/* This function takes last element as pivot, places
|
||||
the pivot element at its correct position in sorted
|
||||
array, and places all smaller (smaller than pivot)
|
||||
to left of pivot and all greater elements to right
|
||||
of pivot */
|
||||
/**
|
||||
* This function takes last element as pivot, places
|
||||
* the pivot element at its correct position in sorted
|
||||
* array, and places all smaller (smaller than pivot)
|
||||
* to left of pivot and all greater elements to right
|
||||
* of pivot
|
||||
*
|
||||
* */
|
||||
|
||||
int partition(int arr[], int low, int high) {
|
||||
int pivot = arr[high]; // taking the last element as pivot
|
||||
@@ -52,10 +55,12 @@ int partition(int arr[], int low, int high) {
|
||||
return (i + 1);
|
||||
}
|
||||
|
||||
/* The main function that implements QuickSort
|
||||
arr[] --> Array to be sorted,
|
||||
low --> Starting index,
|
||||
high --> Ending index */
|
||||
/**
|
||||
* The main function that implements QuickSort
|
||||
* arr[] --> Array to be sorted,
|
||||
* low --> Starting index,
|
||||
* high --> Ending index
|
||||
*/
|
||||
void quickSort(int arr[], int low, int high) {
|
||||
if (low < high) {
|
||||
int p = partition(arr, low, high);
|
||||
|
||||
Reference in New Issue
Block a user