The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
+14 votes

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.9k points)
edited by | 1.9k views

3 Answers

+19 votes
Best answer

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

(from definition of stable sorting)

answered by Veteran (384k points)
edited by
+10 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.


answered by (269 points)
+2 votes
Ans: B
answered by Loyal (7.8k points)

Related questions

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
47,925 questions
52,325 answers
67,785 users