English

In insertion sort average number of comparisons required to place the 7th element into the correct position is: -

Advertisements
Advertisements

Question

In insertion sort average number of comparisons required to place the 7th element into the correct position is:

Options

  • 2

  • 7

  • 4

  • 9

MCQ

Solution

4

Explanation:

(k + 1)/2 is the average number of comparisons necessary to place the 7th element in the correct position. Here, k = 7. As a result, the total number of comparisons is (7 + 1)/2 = 8/2 = 4.

shaalaa.com
Insertion Sort
  Is there an error in this question or solution?
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×