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

20
views
quicksort
+1
vote
1
answer
2
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
(
657
points)

28
views
algorithms
quicksort
0
votes
2
answers
3
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
(
29
points)

128
views
quicksort
sorting
timecomplexity
0
votes
0
answers
4
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
(
37
points)

11
views
quicksort
+3
votes
1
answer
5
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)

79
views
algorithms
probability
quicksort
+1
vote
1
answer
6
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)

82
views
algorithms
quicksort
+1
vote
0
answers
7
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)

161
views
tifr2018
algorithms
quicksort
probability
0
votes
1
answer
8
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
(
8.1k
points)

202
views
quicksort
algorithms
sorting
timecomplexity
0
votes
0
answers
9
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.5k
points)

249
views
quicksort
+4
votes
1
answer
10
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.3k
points)

236
views
algorithms
datastructure
sorting
quicksort
0
votes
1
answer
11
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
(
2k
points)

101
views
algorithms
sorting
sortingalgorithmsquicksort
quicksort
+2
votes
3
answers
12
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
(
949
points)

233
views
algorithms
sorting
timecomplexity
quicksort
+2
votes
1
answer
13
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)

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

191
views
algorithms
quicksort
timecomplexity
sorting
0
votes
2
answers
15
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.1k
points)

346
views
algorithms
quicksort
0
votes
1
answer
16
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
(
709
points)

320
views
quick
quicksort
algorithms
sorting
timecomplexity
+2
votes
1
answer
17
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.2k
points)

419
views
algorithms
quicksort
sorting
0
votes
1
answer
18
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)

166
views
madeeasytestseries
algorithms
quicksort
+8
votes
1
answer
19
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)

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

209
views
algorithms
quicksort
sorting
0
votes
2
answers
21
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.3k
points)

492
views
quicksort
algorithms
sorting
timecomplexity
+3
votes
0
answers
22
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
(
17k
points)

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

170
views
algorithms
quicksort
+2
votes
1
answer
24
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)

177
views
sorting
algorithms
quicksort
+1
vote
1
answer
25
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
Active
(
5.2k
points)

101
views
quicksort
+1
vote
1
answer
26
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.2k
views
algorithms
timecomplexity
quicksort
+3
votes
1
answer
27
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.2k
points)

407
views
algorithms
quicksort
0
votes
1
answer
28
Give the result of partitioning the keys after the 1st pass of quicksort.
asked
Jul 22, 2015
in
Algorithms
by
Saurabh Sharma
Junior
(
579
points)

200
views
sorting
algorithms
quicksort
To see more, click for the
full list of questions
or
popular tags
.
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
kvs pgt
Algorithms GO Classroom
Programming and DS GO Classroom
Discrete Mathematics GO Classroom
Digital Logic GO Classroom
Follow @csegate
Gatecse
Recent questions tagged quicksort
Recent Blog Comments
b.tech passout are eligible to fill this form . ?
I have orderd it on 14 september 2018. Still i...
@Balaji 1.c) is undecidable, r u sure about it?
yes sir TRUE... working on it :). But this...
Second attempt doesnt mean you are strong in...
39,542
questions
46,682
answers
139,878
comments
57,691
users