9 2 8 7 6 5 1 4 3 show the contents of the array above each time an insertion sort changes it while sorting the array into ascending order.

Respuesta :

The array that has been sorted using insertion sorting 1 2 3 4 5 6 7 8 9.

A straightforward sorting algorithm called insertion sort functions like how you might arrange playing cards in your hands.

Initial Pass: 2 9 8 7 6 5 1 4 3

The array's first two members are initially compared using an insertion sort.

Since 9 is bigger than 2, they are not arranged in ascending order, and 2 is not in the proper place. So, switch 9 and 2.

Therefore, 2 is currently kept in a sorted sub-array.

Second Pass: Continue with the next two elements and compare them.

2 8 9 7 6 5 1 4 3

Here, 9 is bigger than 8, therefore both items appear to be in ascending order; as a result, there won't be any switching. Along with 8, 9 is also kept in a sorted sub-array.

Third pass: Currently, the sorted sub-array has two entries, which are 2 and 8.

Moving on to the following two components, which are 9 & 7,

2 7 8 9 6 5 1 4 3

Continue sorting similarly; the results would be 1 2 3 4 5 6 7 8 9.

Learn more about insertion sorting at

https://brainly.com/question/13326461?referrer=searchResults

#SPJ4

RELAXING NOICE
Relax