Question
Which of the following sorting algorithms has the best
average-case time complexity?Solution
Quick Sort is a widely used sorting algorithm that, on average, exhibits a time complexity of O(n log n). This efficiency stems from its divide-and-conquer approach, where the algorithm selects a 'pivot' element and partitions the array into elements less than and greater than the pivot. It recursively sorts the sub-arrays created by this partitioning. Quick Sort is particularly effective for large datasets due to its average-case performance and in-place sorting capability, which means it requires less additional memory compared to algorithms like Merge Sort. While Quick Sort has a worst-case time complexity of O(n^2), which can occur with poor pivot choices (e.g., already sorted data), various strategies, such as randomization or choosing the median as the pivot, can help mitigate this risk. Option A is incorrect because Bubble Sort has an average-case time complexity of O(n^2), making it inefficient for large datasets. Option B is incorrect as Insertion Sort also has an average-case complexity of O(n^2), though it performs well on small or nearly sorted datasets. Option C is incorrect for the same reason as Insertion Sort; Selection Sort also has O(n^2) average-case complexity. Option E, Merge Sort, while having an O(n log n) average-case complexity, requires additional space for merging, making Quick Sort generally faster in practice due to its in-place nature.
What is the primary function of the ‘Jago Grahak Jago App’ launched by the Department of Consumer Affairs?
What does DHRUVA stand for in the context of the digital address initiative launched in 2025?
Which country launched 'Operation Karuna' to assist Myanmar after Cyclone Mocha?
What duration lease has the UK retained over Diego Garcia under the Chagos Islands agreement?
How much surplus did the RBI transfer to the government for FY25?
Who has been named as the brand ambassador of Bandhan Bank in March 2025?
What is the primary theme of Payal Kapadia’s film “All We Imagine As Light,” named the best film of 2024 by Sight and Sound magazine?
_______ and Export-Import Bank of India (India Exim Bank), have entered into an agreement under the Trade Assistance Programme (TAP), to support cross...
On which date and in which city were the 3GPP Radio Access Networks (RAN) Working Group meetings inaugurated—India’s first hosting of these global d...
As per the RBI's latest Report on Currency and Finance (RCF), what is projected to be a key factor sustaining the growth in remittances to India, expect...