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
461
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
(
49.4k
points)

461
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
(
49.4k
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, 2019
in
DS
by
Shamim Ahmed
Active
(
2.5k
points)

141
views
datastructures
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
(
119k
points)

191
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
(
323
points)

137
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)

267
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
Contesting Answer Key Link Is Live Now
Answer keys are released for Gate2020
My Experience at IIT Madras and Some Insights
GATE Meetup at CSA IISC on February 29 as part of CSA Open Day
Make Rank Predictor Dynamic (Again?)
All categories
General Aptitude
1.9k
Engineering Mathematics
7.6k
Digital Logic
2.9k
Programming and DS
4.9k
Programming
3.5k
DS
1.3k
Algorithms
4.4k
Theory of Computation
6.2k
Compiler Design
2.1k
Operating System
4.5k
Databases
4.1k
CO and Architecture
3.4k
Computer Networks
4.2k
Non GATE
1.4k
Others
1.5k
Admissions
595
Exam Queries
573
Tier 1 Placement Questions
23
Job Queries
72
Projects
18
Follow @csegate
Recent Blog Comments
@jlimbasiya Contesting link available only...
Hi Everyone, As anyone who has appeared for ISRO...
So the written test and interview both do not...
So,O(n^2) remains and might be 0(nlogn) further...
Ideally both should be given marks, it shouldn't...
50,833
questions
57,713
answers
199,428
comments
107,715
users