Randomize Quick-Sort | worst case Time : O(NlogN)
cpp\n    int partition(vector<int>&arr,int start,int end){\n        int pivot=arr[end];\n        int partIdx=start;\n        for(int i=start;i<end;i++){\n      
```cpp\n    int partition(vector<int>&arr,int start,int end){\n        int pivot=arr[end];\n        int partIdx=start;\n        for(int i=start;i<end;i++){\n            if(arr[i]<=pivot){\n                swap(arr[i],arr[partIdx]);\n                partIdx++;\n            }\n        }\n        swap(arr[partIdx],arr[end]);\n        return partIdx;\n    }\n    int randompartition(vector<int>&arr,int start,int end){\n\t\t//select random element of array :\n        srand(time(NULL));\n        int pI = start + rand() % (end - start);\n        swap(arr[pI],arr[end]);\n        return partition(arr,start,end);\n    }\n    void quickSort(vector<int>&arr,int start,int end){\n        if(start<end){\n            int partitionIndex=randompartition(arr,start,end);\n            quickSort(arr,start,partitionIndex-1);\n            quickSort(arr,partitionIndex+1,end);\n        }\n    }\n    vector<int> sortArray(vector<int>& arr) {\n        //Quick sort : time: O(nlogn) and space : O(1)\n        quickSort(arr,0,arr.size()-1); \n        return arr;\n    }\n```
['C', 'Sorting', 'C++']