You are viewing a single comment's thread. Return to all comments →
Here is my c++ solution, you can watch the explanation here : https://youtu.be/2HD41pYh8cU
vector<int> quickSort(vector<int> arr) { vector<int> left, equal, right; for(int i = 0; i < arr.size(); i++){ if(arr[i] < arr[0]) left.push_back(arr[i]); else if(arr[i] > arr[0]) right.push_back(arr[i]); else equal.push_back(arr[i]); } left.insert(left.end(), equal.begin(), equal.end()); left.insert(left.end(), right.begin(), right.end()); return left; }
Seems like cookies are disabled on this browser, please enable them to open this website
Quicksort 1 - Partition
You are viewing a single comment's thread. Return to all comments →
Here is my c++ solution, you can watch the explanation here : https://youtu.be/2HD41pYh8cU