ISRO | ISRO CS 2020 | Question 18
If the array A contains the items 10, 4, 7, 23, 67, 12 and 5 in that order, what will be the resultant array A after third pass of insertion sort ?
(A) 67, 12, 10, 5, 4, 7, 23
(B) 4, 7, 10, 23, 67, 12, 5
(C) 4, 5, 7, 67, 10, 12, 23
(D) 10, 7, 4, 67, 23, 12, 5
Answer: (B)
Explanation: Given array:
10, 4, 7, 23, 67, 12, 5
According to Insertion sort : Values from the unsorted part are picked and placed at the correct position in the sorted part.
After 1st pass:
4, 10, 7, 23, 67, 12, 5
After 2nd pass:
4, 7, 10, 23, 67, 12, 5
After 3rd pass:
4, 7, 10, 23, 67, 12, 5
Option (B) is correct.
Quiz of this Question
Last Updated :
03 Sep, 2020
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...