Question
Which of the following sorting algorithms is NOT
stable?ÂSolution
Quick Sort is not a stable sorting algorithm. Stability in sorting algorithms means that equal elements retain their relative order before and after sorting. Quick Sort does not guarantee this behavior because, during partitioning, equal elements may get swapped in such a way that their relative order is not preserved. Although Quick Sort is an efficient comparison-based sorting algorithm with an average time complexity of O(n log n), its lack of stability makes it unsuitable for cases where maintaining relative order of equivalent elements is crucial. Why Other Options are Incorrect: A) Merge Sort: This is a stable sorting algorithm as it ensures that the relative order of equal elements remains unchanged. B) Bubble Sort: Bubble Sort is stable as elements are swapped only if necessary. D) Insertion Sort: Insertion Sort is stable because it inserts equal elements in their original order. E) Tim Sort: Tim Sort is a stable sorting algorithm, combining Merge Sort and Insertion Sort properties.
If the sum of upstream and downstream speed is 24 km/hr and the speed of the current is 5 km/hr. Then find time taken to cover 51 km in downward?
A boat can cover 176 km in downstream in 11 hours and 150 km in upstream in 15 hours. Find the speed of boat in still water
A man rows upstream 10 km and downstream 15 km taking 5 hours each. Find the speed of current.
...A boat can cover a distance of 210 km downstream with the current in 5 hours. It takes an additional 2.5 hours to return the same...
A boat can travel 72 km upstream and 108 km downstream in 5 hours. Find the speed of the boat in still water if the ratio of the ...
A Motarboat running upstream takes 6 hours and 45 minutes to cover a distance, while it takes 3 hours to cover the same distance running downstream. Det...
A boat takes 7 hours to cover 259 km upstream and 9 hours to cover 477 km downstream. Find the time taken by the boat to cover 645 km upstream and 660 k...
A man can row upstream at 18 km/hr and downstream at 24 km/hr. Find the man’s rate in still water and the rate of the current.   Â
...A boat running downstream covers a distance of 45 km in 9 hrs and covering the same distance upstream in 15 hrs. What is the speed of a boat in still wa...
The speed of a boat in still water is 45 km/hr, and the speed of the stream is 5 km/hr. The boat takes 30 minutes longer to cover a distance of x km ups...