Start learning 50% faster. Sign in now
The quick sort algorithm, which follows a divide-and-conquer approach, usually achieves an average time complexity of O(n log n) by dividing an array into smaller subarrays, sorting each recursively. However, the algorithm’s performance heavily depends on how well it chooses the pivot element for each partition. When the pivot is consistently chosen poorly—such as always selecting the smallest or largest element in a sorted or nearly sorted array—the partitions become unbalanced, leading to a worst-case time complexity of O(n²). In this scenario, where the data is already ordered, the quick sort algorithm must process each element within increasingly unbalanced partitions, leading to nested recursive calls that significantly slow down execution. The other options are incorrect for the following reasons: • Option 1 (O(n)) is incorrect because quick sort does not exhibit linear performance, even in optimal conditions. Sorting generally requires more than O(n) operations. • Option 2 (O(n log n)) represents the best and average cases of quick sort when the partitions are balanced, which reduces the number of levels in the recursion tree. • Option 3 (O(log n)) is incorrect as it typically represents the time complexity of searching algorithms like binary search, not sorting algorithms. • Option 5 (O(n³)) is much higher than quick sort’s worst-case complexity and would imply an excessive number of operations that do not apply to the algorithm's nature.
The largest 5 digit number which is exactly divisible by ‘33’ is:
A number when divided by 45 leaves a remainder 21. What will be the remainder when the square of the same number is divided by 45?
Find the remainder when 23 x 34 x 45 x 56 x 67 x 78 is divided by 11.
If 2557 + 819 is divisible by which of the following numbers.
If 1234567y is divisible by 11, then what is the value of y?
A number gives a remainder of 27 when divided by 36. What will be the remainder when the same number is divided by 12?
What are the last two digits of 56283 x 141283 × 125254?
x + 5x – 2x – 24 has a zero at x = 6. Find the other zeros.
which of the following pairs of non-zeroes values of p and q make the 6-digit number 674pq0 divisible by both 3 and 11?