+1 vote
in Data Structures & Algorithms II by (110k points)
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) 14

This question was addressed to me in an online quiz.

This key question is from Insertion sort in portion Sorting of Data Structures & Algorithms II

1 Answer

+1 vote
by (614k points)
selected by
 
Best 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.

Related questions

Welcome to TalkJarvis QnA, a question-answer community website for the people by the people. On TalkJarvis QnA you can ask your doubts, curiosity, questions and whatever going in your mind either related to studies or others. Experts and people from different fields will answer.

Categories

...