...

/

Sort an Array Using Quicksort Algorithm

Sort an Array Using Quicksort Algorithm

Given an integer array, sort it in ascending order using quicksort.

Statement

Given an array of integers nums, sort it in ascending order using the quicksort algorithm.

Example

Here’s an example of the quicksort algorithm:

g array Original array 0 1 2 3 4 55 23 26 2 25 array2 Sorted array 0 1 2 3 4 2 23 25 26 55

Sample input

[55, 23, 26, 2, 25]

Expected output

[2, 23, 25, 26, 55]

Try it yourself #

#include <iostream>
#include <vector>
using namespace std;
void QuickSort(vector<int> &nums, int size) {
// TODO: Write - Your - Code
return;
}

Solution

Here is an overview of how the quicksort algorithm works:

  • Select a pivot element from the
...