Repository: TheAlgorithms/C-Plus-Plus
File: sorting/quick_sort.cpp (C++)

Code before:
/**
 * @file
 * @brief [Quick sort implementation](https://en.wikipedia.org/wiki/Quicksort)
 * in C++
 * @details
 *      Quick Sort is a [divide and conquer
 * algorithm](https://en.wikipedia.org/wiki/Category:Divide-and-conquer_algorithms).
 *      It picks an element as pivot and partition the given array around the
 * picked pivot. There are many different versions of quickSort that pick pivot
 * in different ways.
 *
 *      1. Always pick the first element as pivot
 *      2. Always pick the last element as pivot (implemented below)
 *      3. Pick a random element as pivot
 *      4. Pick median as pivot
 *
 *      The key process in quickSort is partition(). Target of partition is,
 *      given an array and an element x(say) of array as pivot, put x at it's
 *      correct position in sorted array and put all smaller elements (samller
 *      than x) before x, and put all greater elements (greater than x) after
 *      x. All this should be done in linear time
 *
 * @author [David Leal](https://github.com/Panquesito7)
 * @author Unknown author
 */

#include <algorithm>  /// for std::is_sorted
#include <cassert>    /// for std::assert
#include <ctime>      /// for std::time
#include <iostream>   /// for IO operations
#include <vector>     /// for std::vector

/**
 * @brief Sorting algorithms
 * @namespace sorting
 */
namespace sorting {
/**
 * @namespace quick_sort
 * @brief Functions for the [Quick sort
 * implementation](https://en.wikipedia.org/wiki/Quicksort) in C++
 */
namespace quick_sort {
/**
 * @brief Sorts the array taking the last element as pivot
 * @details
 * 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)

Review comment (bug):
Non-blocking; I think you can figure it out if you check out the commit `f22baf19210b17c8567d461ad35259322543701c` in your local - I don't have this repo cloned in my local env so can't do this. This was the parent commit before `ayankhan` made his changes to fix overflow issues, once you check that out you can do `git blame sorting/quick_sort.cpp` to check who wrote it 😄.

Code after:
/**
 * @file
 * @brief [Quick sort implementation](https://en.wikipedia.org/wiki/Quicksort)
 * in C++
 * @details
 *      Quick Sort is a [divide and conquer
 * algorithm](https://en.wikipedia.org/wiki/Category:Divide-and-conquer_algorithms).
 *      It picks an element as pivot and partition the given array around the
 * picked pivot. There are many different versions of quickSort that pick pivot
 * in different ways.
 *
 *      1. Always pick the first element as pivot
 *      2. Always pick the last element as pivot (implemented below)
 *      3. Pick a random element as pivot
 *      4. Pick median as pivot
 *
 *      The key process in quickSort is partition(). Target of partition is,
 *      given an array and an element x(say) of array as pivot, put x at it's
 *      correct position in sorted array and put all smaller elements (samller
 *      than x) before x, and put all greater elements (greater than x) after
 *      x. All this should be done in linear time
 *
 * @author [David Leal](https://github.com/Panquesito7)
 * @author [popoapp](https://github.com/popoapp)
 */

#include <algorithm>  /// for std::is_sorted
#include <cassert>    /// for std::assert
#include <ctime>      /// for std::time
#include <iostream>   /// for IO operations
#include <vector>     /// for std::vector

/**
 * @brief Sorting algorithms
 * @namespace sorting
 */
namespace sorting {
/**
 * @namespace quick_sort
 * @brief Functions for the [Quick sort
 * implementation](https://en.wikipedia.org/wiki/Quicksort) in C++
 */
namespace quick_sort {
/**
 * @brief Sorts the array taking the last element as pivot
 * @details
 * 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)