Sara P.

asked • 07/11/20

What is the answer of this problem?(This is for java code)

When rearranged in ascending order using the insertion sorting algorithm,

which one among the arrays listed below will need the fewest changes of positions

for the elements?

a. { 3, 5, 4, 1, 2}

b. { 5, 1, 2, 3, 4}

c. { 4, 3, 2, 1, 5}

d. { 4, 5, 1, 2, 3}

e. { 1, 5, 4, 3, 2}

1 Expert Answer

By:

Patrick B. answered • 07/11/20

Tutor
4.7 (31)

Math and computer tutor/teacher

Sara P.

Thank you so much!
Report

07/12/20

Patrick B.

Denada and you're welcome. Quick sort is faster for random input. Insertion sort is faster for arrays that are ALMOST sorted.
Report

07/12/20

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.