The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
+15 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 (52k points)
edited by | 2.1k views

3 Answers

+20 votes
Best answer

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

(from definition of stable sorting)

answered by Veteran (406k points)
edited by
+11 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 (277 points)
+2 votes
Ans: B
answered by Loyal (6.9k 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
49,540 questions
54,099 answers
71,007 users