The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+12 votes
1.6k views

A sorting technique is called stable if

  1. it takes $O (n \log n)$ time
  2. it maintains the relative order of occurrence of non-distinct elements

  3. it uses divide and conquer paradigm

  4. it takes $O(n)$ space

asked in Algorithms by Veteran (59.6k points)
edited by | 1.6k views

3 Answers

+17 votes
Best answer

(B) If it maintains the relative order of occurrence of non-distinct elements.

(from definition of stable sorting)

answered by Veteran (359k points)
edited by
+7 votes

Answer (B)

A sorting algorithm is said to be stable if two objects with equal keys appear in the same order in sorted output as they appear in the input array to be sorted. Some sorting algorithms are stable by nature like Insertion sort, Merge Sort, Bubble Sort, etc. And some sorting algorithms are not, like Heap Sort, Quick Sort, etc.

Ref: https://stackoverflow.com/questions/1517793/what-is-stability-in-sorting-algorithms-and-why-is-it-important

answered by (259 points)
+2 votes
Ans: B
answered by Loyal (7.4k points)


Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

41,078 questions
47,675 answers
147,464 comments
62,393 users