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

I forgot my password
All Activity
Questions
Unanswered
Tags
Subjects
Users
Ask
Previous
Blogs
New Blog
Exams
First time here? Checkout the
FAQ
!
x
×
Close
Use the google search bar on side panel. It searches through all previous GATE/other questions. For hardcopy of previous year questions please see
here
Recent questions tagged quicksort
0
votes
0
answers
1
hoare and loranto quicksort
between hoare and loranto quicksort which give better cache performance ? we know that in hoare quicksort we move the pointer i,j in different direction but in loranto quicksort we move i,j in same direction so the cache performance of loranto should be better?
asked
3 days
ago
in
Algorithms
by
Gurdeep Saini
Active
(
3.2k
points)

16
views
algorithms
sortingalgorithmsquicksort
sorting
quicksort
0
votes
0
answers
2
Quick Sort Analysis
Consider the Quicksort algorithm.Suppose there is a procedure for finding a pivot element which splits the list into two sublists each of which contains at least onefifth of the elements.Let T(n) be the number of comparisons required to sort n elements.Then: A. T(n)<=2T(n/5)+n B. T(n)<=T(n/5)+T(4n/5)+n C. T(n)<=2T(4n/5)+n D. T(n)<=2T(n/2)+n
asked
Sep 21
in
Algorithms
by
Vaishnavi01
(
197
points)

69
views
quicksort
algorithms
sorting
timecomplexity
gate
0
votes
0
answers
3
Code Quick Sort
Why the code is not showing correct sorting ?(here pivot is smaller index element, i.e. arr[low]) #include <stdio.h> #include <stdlib.h> #include <time.h> void fillArray(int array[], int n) { time_t t; time(&t);//get current time srand(t);/ ... ;n); array = malloc(n * sizeof(int)); fillArray(array, n); quickSort(array,low,n); printArray(array, n); return 0; }
asked
Aug 16
in
Programming
by
srestha
Veteran
(
100k
points)

22
views
quicksort
+1
vote
1
answer
4
Made Easy algorithms
After applying few passes of quick sort on a given array, the following output was obtained: 1,10,5,8,25,44,55,30,70 Then how many pivot elements are there in the above output?
asked
Aug 6
in
Algorithms
by
Sambhrant Maurya
Junior
(
899
points)

34
views
algorithms
quicksort
+1
vote
2
answers
5
Quick Sort Time Complexity
Quick sort gives O(nlogn) worst case performance if the pivot is selected as: a) First element of the array b) Median of first, last and middle elements c) Arithmetic mean of the elements d) None of these Now, the answer is given as Option (b). But, ... order of elements and not on pivot element. So, answer should be option (d) i.e None of these Correct me if I am wrong
asked
Jul 1
in
Algorithms
by
garvit_vijai
(
87
points)

191
views
quicksort
sorting
timecomplexity
0
votes
0
answers
6
cormen 3rd edition 7.26
Argue that for any constant 0<α≤1/2, the probability is approximately 1−2α that on a random input array, PARTITION produces a split more balanced than 1−α to α. Please explain how the probability is calculated?
asked
Jun 14
in
Algorithms
by
Aarvi Chawla
(
45
points)

12
views
quicksort
+3
votes
1
answer
7
Quick Sort Algorithm
Let $0<α<.5$ be some constant (independent of the input array length $n$). What is the probability that, with a randomly chosen pivot element, the Partition subroutine produces a split in which the size of the smaller of the two subarrays is $≥α$ times the size of the original array? 1. $1  2*\alpha$ 2. $\alpha$ 3. $1  \alpha$ 4. $2  2*\alpha$
asked
May 23
in
Algorithms
by
Shailin Shah
(
109
points)

92
views
algorithms
probability
quicksort
+1
vote
1
answer
8
Doubt
In Randomized Quick sort, Can we have partitioning algorithm that never gives worst case as $O(n^2)$ for every input?
asked
Mar 29
in
Algorithms
by
Angkit
Active
(
3.8k
points)

87
views
algorithms
quicksort
+1
vote
0
answers
9
TIFR 2018
Consider the recursive quicksort algorithm with random pivoting . That is, in each recursive call, a pivot is chosen uniformly at random from the subarray being sorted. When this randomized algorithm is applied to an array of size n all whose elements are distinct, what is the probability that the smallest and ... $ (b) $\frac{2}{n}$ (c) Θ($\frac{1}{nlogn}$) (d) Θ($\frac{1}{n log^2n}$)
asked
Jan 25
in
Algorithms
by
mastershaikh
(
453
points)

190
views
tifr2018
algorithms
quicksort
probability
0
votes
1
answer
10
quick sort
You have an array of n elements. Suppose you implement quick sort by always choosing the central element of the array as the pivot. Then the tightest lower bound for the best case performance is a) O(n2) b) O(nlogn) c) Θ(nlogn) d) O(n3)
asked
Jan 14
in
Algorithms
by
iarnav
Loyal
(
9k
points)

219
views
quicksort
algorithms
sorting
timecomplexity
0
votes
0
answers
11
Quick Sort Number Of Comparison Query
What is the number of Comparison to sort below arrays using quick sort using first element as pivot ? Please show steps . A1=4,1,5,3,2 A2=1,2,3,4,5
asked
Dec 3, 2017
in
Algorithms
by
hem chandra joshi
Active
(
4.6k
points)

307
views
quicksort
+4
votes
1
answer
12
Modified form of GATE1996_2.15
Quicksort is run on two inputs shown below to sort in ascending order taking first element as pivot i) 1,2,3,…n ii) n,n−1,n−2,…,2,1 Let S1 and S2 be the number of swaps made for the inputs (i) and (ii) respectively. Then, i) How is S1 and S2 related ? ii) How will the answer change if the pivot is changed to middle element ?
asked
Oct 18, 2017
in
Algorithms
by
rishi71662data4
Active
(
2.4k
points)

252
views
algorithms
datastructure
sorting
quicksort
0
votes
1
answer
13
QUICKSORT
Could anyone describe how the partitioning algorithm vary when the pivot is varied ? In Cormen , last element is taken as pivot . Suppose I took first element or middle element or 3 rd element as pivot then how the partitioning algorithm will change.
asked
Sep 27, 2017
in
Algorithms
by
ashwina
Active
(
2.1k
points)

106
views
algorithms
sorting
sortingalgorithmsquicksort
quicksort
+2
votes
3
answers
14
Quick Sort
"Quick sort has good cache performance" , Can anyone explain this statement.How is cache related to quick sort.I searched for this over the internet but could not find a good article.
asked
Sep 3, 2017
in
Algorithms
by
Sourajit25
Junior
(
975
points)

245
views
algorithms
sorting
timecomplexity
quicksort
+2
votes
1
answer
15
Quick sort
When array is already sorted in reverse order then what will be the recurrence relation for number of swaps on array of n elements using quick sort?
asked
Aug 10, 2017
in
Algorithms
by
SHALINI PORWAL
(
31
points)

284
views
algorithms
sorting
timecomplexity
quicksort
+2
votes
3
answers
16
With quick sort The results after first partioning of the given array
asked
Apr 15, 2017
in
Algorithms
by
LavTheRawkstar
Active
(
5.2k
points)

198
views
algorithms
quicksort
timecomplexity
sorting
0
votes
2
answers
17
A list of elements are given A  <3,1,4,1,5,9,2,6,5,3,5,8,9 >
asked
Apr 15, 2017
in
Algorithms
by
LavTheRawkstar
Active
(
5.2k
points)

358
views
algorithms
quicksort
0
votes
1
answer
18
GATE 2008 Quick Sort
Consider the Quicksort algorithm. Suppose there is a procedure for finding a pivot element which splits the list into two sublists each of which contains at least onefifth of the elements. Let T(n) be the number of comparisons required to sort n elements. Then A. T(n) < ... (4n/5) + n, if elements are more than (n/5)( since it is given 'AT LEAST'). Where am I going wrong?
asked
Mar 29, 2017
in
Algorithms
by
Bongbirdie
Junior
(
727
points)

340
views
quick
quicksort
algorithms
sorting
timecomplexity
+2
votes
1
answer
19
quick sort
If we use quicksort algorithm to sort the elements: $16, 13, 14, 12, 21, 16, 23$ and $15$ in ascending order, what is the output after the first pass of quicksort? (Assume pivot element is beginning of an array)
asked
Jan 20, 2017
in
Algorithms
by
Debashish Deka
Veteran
(
57.4k
points)

439
views
algorithms
quicksort
sorting
0
votes
1
answer
20
me test series
Consider an array with the following elements: 12, 18, 17, 11, 13, 15, 16 and 14. The number of element will change their initial position after completion of partition algorithm by choosing 15 as pivot are ________. plss explain by each pass
asked
Dec 13, 2016
in
Algorithms
by
Rajesh Raj
Active
(
4.9k
points)

169
views
madeeasytestseries
algorithms
quicksort
+8
votes
1
answer
21
New Gradience Sorting
There are many variations of Quicksort. We may choose the pivot for each partition step in various ways. There are various strategies for partitioning an array segment into one subpartition of consecutive array positions that has values less than or equal to the pivot and another subpartition of consecutive array ... , 8, 9 b) 3, 1, 3, 1 c) 5, 4, 3, 3, 5 d) 1, 4, 1, 3
asked
Nov 15, 2016
in
Algorithms
by
mohit chawla
Active
(
2.7k
points)

378
views
sorting
quicksort
algorithms
+1
vote
1
answer
22
quick sort
Is quick sort inplace algorithm?
asked
Nov 7, 2016
in
Algorithms
by
vaishali jhalani
Loyal
(
5.9k
points)

212
views
algorithms
quicksort
sorting
0
votes
2
answers
23
Quick sort
@arjun sir why is quick sort with median as pivot not in practice even though it can sort the worst case list in O(nlogn) time? median can be found in O(n) time and this divides list into two halves. recurrance relation becomes T(n) = ... implement it bcoz "The hidden constants in this approach are high compared to normal Quicksort" but why are we caring about constants here?
asked
Nov 2, 2016
in
Algorithms
by
Anusha Motamarri
Boss
(
12.4k
points)

506
views
quicksort
algorithms
sorting
timecomplexity
+3
votes
0
answers
24
Doubt: DAA: Quick Sort
If every time a median which takes O(n) to be found, is chosen as pivot, then Quick Sort takes theeta(nlogn) time complexity. My question is if all the elements are same, will still be this median Quick Sort have time complexity as theeta(nlogn)?? Can someone please run the algo for 10, 10, 10, 10, 10 if the worst time TC is nlogn in case if median Quick Sort.
asked
Nov 2, 2016
in
Algorithms
by
Vijay Thakur
Boss
(
17.1k
points)

203
views
algorithms
sorting
timecomplexity
quicksort
0
votes
1
answer
25
Algorithm
asked
Oct 7, 2016
in
Algorithms
by
Rahul Jain25
Boss
(
11.6k
points)

181
views
algorithms
quicksort
+2
votes
1
answer
26
Randomised quicksort
Let us a consider a series of events where a random partition procedure always picks the median element among n distinct numbers dividing the array into two equal halves ( ignore floor and ceiling). What is the probability that such a partition procedure always picks the median element in all subsequent arrays till the entire array is sorted.
asked
Oct 4, 2016
in
Algorithms
by
vivek9837
Junior
(
913
points)

191
views
sorting
algorithms
quicksort
+1
vote
1
answer
27
quick sort
is it quick sort is inplace algorithm. according to me it takes o(logn) space in best case and as i know any algo takes more then 0(1) spcae count as not inplace algo then why quick sort is inplace plz explain clearly
asked
Jul 25, 2016
in
Algorithms
by
rajan
Loyal
(
5.3k
points)

107
views
quicksort
+1
vote
1
answer
28
quick sort time complexity
the worst case time complexity of quicksort for an elements when the median is selected as the pivot a. o(n^2) b.o(n) c.o(nlogn) d.o(logn)
asked
Mar 9, 2016
in
Algorithms
by
akankshay
(
29
points)

1.3k
views
algorithms
timecomplexity
quicksort
+3
votes
1
answer
29
Quick Sort
Consider an array with the following elements: 12, 18, 17, 11, 13, 15, 16 and 14. How many element will change their initial position after completion of partition algorithm by choosing 15 as pivot? Given Answer : 7 ( only 16 is not swapped ) My Answer : 6 ( 16 ... 13 14 12 11 15 17 16 18 So 11 and 16 are not changed all other elements have changed their position Correct me if i am wrong
asked
Jan 17, 2016
in
Algorithms
by
pC
Boss
(
22.4k
points)

418
views
algorithms
quicksort
Page:
1
2
next »
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
Basic LaTeX guide
IIT Madras Phd
Databases GO Classroom
Happy Birthday Sir Arjun
NIELIT EXAM DATE 2018
Follow @csegate
Gatecse
Recent questions tagged quicksort
Recent Blog Comments
@Gaurav Go through all the previous yr questions,...
Belated Happy Birthday Arjun Sir
No issue, and quicklatex is useful.
Oh, I didn't notice that post. Should I let this...
42,458
questions
48,493
answers
154,720
comments
63,093
users