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.
Arman Funded an amount at the rate of 6 % for a period of 2 years at C.I. while calculating, the rate of interest was interchanged with the time period ...
The difference between compound interest and simple interest at rate of 10% per annum for 2 years is Rs. 120. Find the simple interest obtained on same ...
"Zampa invested Rs.__________ in an SBI Contra fund with a 20% annual compound interest, compounded annually. At the end of each year, the bank deducts ...
What is the difference between the simple interest earned on an investment of Rs. 16,200 for 5.5 years at an annual interest rate of 8%, and the total a...
The interest received by investing Rs. 4000 for 2 years at compound interest of 20% p.a., compounded annually, was re-invested for 3 years at simple int...
A certain sum of money becomes 5000 in 6 years and Rs. 6240 in 10 years at any certain rate of simple interest. Find the principal amount.
Simran Funded Rs. 70,000 in two different SIP's. She funded the smaller amount at CI of 20% p.a. compounded annually, and larger amount at SI of 16.5% f...
The interest earned when a sum is invested at simple interest of 5% p.a., for 3 years, is Rs. 5280. What will be the total amount received after 2 years...
Find the approx. compound interest on Rs. 5000 at 4% per annum for 2 years compounded half yearly?
A man invested certain sum at simple interest of r% p.a. such that it amounts to 160% of itself in 6 years. Find the interest earned when Rs. 2400 is in...