Open In App

Algorithms | InsertionSort | Question 4

Consider the array A[]= {6,4,8,1,3} apply the insertion sort to sort the array . Consider the cost associated with each sort is 25 rupees , what is the total cost of the insertion sort when element 1 reaches the first position of the array  ?
(A) 50
(B) 25
(C) 75
(D) 100

Answer: (A)
Explanation: When the element 1 reaches the first position of the array two comparisons are only required hence 25 * 2= 50 rupees.

*step 1: 4 6 8 1 3 .

*step 2: 1 4 6 8 3.
Quiz of this Question

Article Tags :