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.
Six persons S, T, U, V, W, and X live on different floors of a six-floor building. The bottommost floor is numbered as 1 and the topmost floor is number...
Five person P, Q, R, S and T all are sitting around a circle. Who are sitting around the circular table facing towards the centre?
I. S sits to ...
How is A related to B?
I Â C has only two kids A & B and is father-in-law of D who is brother-in-law of B
II Â R is brother-in-law of A ...
What is Didu’s rank in the class?
Statement I:         Didu’s rank from the bottom is 49th and there are 50 students in ...
Which direction Mita is facing?
Statement I: Â Mita started walking from point P.
Statement II: She took two consecutive right turns.
O, P, Q, S, T and V are standing in straight line facing north. Who among the following is between S and V?
I. V stand second to the right of S. ...
How is ‘feedback’ written in a code language?
I. In a certain code language ‘corporate office branch centre’ is written as ‘ki pa mt  ...
Five friends Harsha, Geeta, Naman, Suraj and Anuj are seated around a circular table facing the centre. Who sits to the immediate right of Suraj?
How is B related to C?
I. C and D are the sons of E. B is son of E’s father.
II. E is sister of B and mother of D, who is brother of C.
The question given below consists of two statements numbered I and II given below it. You have to decide whether the data provided in the statements a...