Problem Submissions Solution

Quick Sort

Difficulty: Medium

Acceptance: %

Points: 30.00

Implement the Quick Sort algorithm, which is a Divide and Conquer technique, to sort an array arr[] in ascending order. Given an array arr[], with a starting index low and an ending index high, complete the functions partition() and quickSort(). The pivot should be chosen as the last element of the array, such that all elements smaller than or equal to the pivot are placed before it, and all elements greater than the pivot are placed after it.

Note: The indices low and high are inclusive.

Topics

Companies

Articles

Examples:

Expected Time Complexity: O(n log n)

Expected Auxiliary Space: O(log n)

Constraints:
  • 1 <= arr.size() <= 10^5
  • 1 <= arr[i] <= 10^5
Companies:
Amazon Microsoft Samsung Adobe Goldman Sachs + 1 more
Topics:
Sorting Algorithms
Locked Content
Access Restricted: Please Login to access the code editor and test cases.