Consider the following array (12,3,1,5,8) Tell us the number of steps that are required to sort the elements int the ascending order using insertion sort
Answers
Answered by
0
Answer:
Sorry bro I don't know
Answered by
3
Insertion Sort:
12 3 1 5 8
Compare 1 element with 2 and swap
3 12 1 5 8
Compare 2 with third
3 1 12 5 8
compare third with fourth
3 1 5 12 8
Compare fourth with fifth
3 1 5 8 12
compare first with second
1 3 5 8 12
Hence we get the sorted array.
Similar questions