# Apply Quick sort on a given sequence 7 11 14 6 9 4 3 12. What is the sequence after first phase, pivot is first element?

+1 vote
1.7k views
Apply Quick sort on a given sequence 7 11 14 6 9 4 3 12. What is the sequence after first phase, pivot is first element?

(a) 6 4 3 7 11 9 14 12

(b) 6 3 4 7 9 14 11 12

(c) 7 6 14 11 9 4 3 12

(d) 7 6 4 3 9 14 11 12

This question was addressed to me in semester exam.

The above asked question is from Quicksort topic in chapter Sorting of Data Structures & Algorithms II

## 1 Answer

+1 vote
by (687k points)
selected by

Best answer
The correct answer is (b) 6 3 4 7 9 14 11 12

To explain: Let’s apply Quick sort on the given sequence,

For first phase, pivot = 7

7          11     14     6     9     4     3     12

i                                                          j

7     11     14     6     9     4     3     12

i                                       j

7     3     14     6     9     4     11     12

i                     j

7     3     4     6     9     14     11     12

i      j

7     3     4     6     9     14     11     12

j      i

6      3      4      7      9      14      11      12

+1 vote
1 answer
+1 vote
1 answer
+1 vote
1 answer
+1 vote
1 answer
+1 vote
1 answer
+1 vote
1 answer
+1 vote
1 answer
+1 vote
1 answer
+1 vote
1 answer