The Gateway to Computer Science Excellence
For all GATE CSE Questions
Toggle navigation
Facebook Login
or
Email or Username
Password
Remember
Login
Register

I forgot my password
Activity
Questions
Unanswered
Tags
Subjects
Users
Ask
Prev
Blogs
New Blog
Exams
sorting
+1
vote
449
views
The algorithm that will efficiently sort an array that is nearly sorted except for the interchange of some adjacent pairs of numbers like : { 1, 3, 2, 5, 4, 6} is:
(A) Quick sort (B) Bubble sort
(C) Merge sort (D) Selection sort
asked
Apr 23, 2016
in
DS
by
Sanjay Sharma
Boss
(
48.8k
points)

449
views
answer
comment
Please
log in
or
register
to add a comment.
Please
log in
or
register
to answer this question.
1
Answer
+1
vote
should it be B
answered
Apr 23, 2016
by
Sanjay Sharma
Boss
(
48.8k
points)
comment
0
why not merge sort?
+2
since list is nearly sorted so by using bubble sort very few exchanges say 2 or 3 will do the job while for merge sort whole array has to be divided and then again merged in addition to comparison and all
0
yes
Please
log in
or
register
to add a comment.
← Prev. Qn. in Sub.
Next Qn. in Sub. →
← Prev.
Next →
Related questions
0
votes
0
answers
1
MadeEasy Test Series: Programming & DS  Sorting
An array A of size n is known to be sorted except for the first k elements and the last k elements, where k is a constant. Which of the following algorithms will be the best choice for sorting the array A? aInsertion Sort bBubble sort cQuicksort dSelection sort
asked
Jan 1
in
DS
by
Shamim Ahmed
Active
(
2.4k
points)

130
views
datastructure
madeeasytestseries
sorting
0
votes
0
answers
2
Heap Sorting
Consider a binary tree, where left and right subtreealready heapified. But we havenot done heapificationfor root yet. Then what is time complexity to convert it in a full heap tree? $A)O(\log n)$ or $o(n)$ $B)\Omega (\log n)$ or $\omega(n)$ $C)\Theta (\log n)$ or $\theta (n)$ $D)\text{None of these}$
asked
Aug 18, 2018
in
DS
by
srestha
Veteran
(
117k
points)

176
views
algorithms
sorting
heap
binaryheap
timecomplexity
+1
vote
1
answer
3
Sorting
Which sorting algorithm is good if we already knew the range of number  Counting Sort OR Radix Sort
asked
Jun 5, 2018
in
DS
by
jatinkumar
(
307
points)

130
views
sorting
timecomplexity
algorithms
+4
votes
2
answers
4
Sorting
We need to sort 7 numbers each of 4 digits. What is the number of comparisons in worst case . Options are as follows: 1) 40 2) 38 3) 47 4) 280
asked
Jun 4, 2017
in
DS
by
Nisha kumari
(
317
points)

261
views
sorting
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
Recent Posts
ECIL Interview Experience
Linear Algebra Important Points
GATE 2020
OFFICIAL GATE MOCK TEST RELEASED
IIITH: Winter Research Admissions 2019 (For Spring 2020)
All categories
General Aptitude
1.9k
Engineering Mathematics
7.5k
Digital Logic
2.9k
Programming and DS
4.9k
Programming
3.5k
DS
1.3k
Algorithms
4.3k
Theory of Computation
6.2k
Compiler Design
2.1k
Operating System
4.5k
Databases
4.1k
CO and Architecture
3.4k
Computer Networks
4.1k
Non GATE
1.5k
Others
1.5k
Admissions
595
Exam Queries
576
Tier 1 Placement Questions
23
Job Queries
72
Projects
17
Follow @csegate
Recent Blog Comments
@Ayush Upadhyaya Thank you so much! ^_^
@JashanAroraNo No. Don't directly say no.Think a...
@jeetYes, I am sorry for that.I saw ECIL Advt...
Congratulations man! A little question, please?...
Is IT eligible to apply in ECIL because they only...
50,645
questions
56,587
answers
195,788
comments
101,840
users