Sort an Array Using Quicksort Algorithm
Given an integer array, sort it in ascending order using quicksort.
We'll cover the following...
We'll cover the following...
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:
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 - Codereturn;}
Solution
Here is an overview of how the quicksort algorithm works:
- Select a
pivot
element from the