edited by
5,521 views
2 2 votes

8 Answers

Best answer
4 4 votes

If I swap 15 with the last element, then 12 and 16 remain unchanged !!

Then, total elements which change their positions are 6.


If I swap 15 with the first element, then only 16 remains unchanged !!

Hence, in this case the elements which change their positions are 7.


This question is ambiguous as i think it should give the position. But if not given( like here ), i would go with the maximum .i.e, 7.

As in both the case only 16 is constant by any method, we apply and all others (CAN) change their position means they are having the ability to change their positions . Hence I suppose , 7 should be correct .

selected by
3 3 votes

7 ans

2 2 votes

Answer will be (7).

0 0 votes
simply make one move in the beginning to swap the 15 to position from where u are comfortable to apply quick sort algorithm either at middle, first position or last.
0 0 votes
You have to choose 15 here as pivot element.

The sequence becomes after first pass will be

12,11,13,14,15,17,16,18
0 0 votes
Before partition Algo 12 18 17 11 13 15 16 14
After partition Algo 14 11 13 12 15 18 16 17

7 elements change their position

Answer:
Position:
Show:

Related questions

1 1 vote
1 answers 1 answer
883
883 views
Rohan Mundhey asked Nov 9, 2016
883 views
Consider the following sequence of letters (Assume always select last element as pivot and array index starts with 0)Q, U, I, C, K, S, O, R, T, E, X, A, M, P, L, EWhat is...
1 1 vote
1 answers 1 answer
2.5k
2.5k views
GateAspirant999 asked May 19, 2016
2,452 views
Is below question and its answer correct? Or its just kind of rubbish?After one pass through the partition procedure of quick sort array stand as below:2,1,4,5,9,7,8,10H...
1 1 vote
1 1 answer
150
150 views
GO Classes asked Aug 31
150 views
During sorting, one complete processing of all elements whose final positions have not yet been determined is called a pass.Which of the following sequences cannot be the...
0 0 votes
1 1 answer
118
118 views
GO Classes asked Aug 10
118 views
Consider the Quick sort algorithm which sorts elements in ascending order using the first element as pivot. Then which of the following input sequence will require a maxi...