1.

In insertion sort, the average number of comparisons required to place the 7^th element into its correct position is ____(a) 9(b) 4(c) 7(d) 14This question was addressed to me in an online quiz.This key question is from Insertion sort in portion Sorting of Data Structures & Algorithms II

Answer»

Right OPTION is (b) 4

Best explanation: On average (k + 1) / 2 comparisons are required to place the k^th ELEMENT into its correct position. THEREFORE, average number of comparisons required for 7th element = (7 + 1)/2 = 4.



Discussion

No Comment Found

Related InterviewSolutions