31.3k views
3 votes
I have an array that is already sorted. Periodically, some new data comes in and is added to the array at random indexes, messing up the ordering. I need to re-sort the array to get it back to being fully ordered. I do not want to use very much additional memory during the sort. Choose the sorting algorithm we studied that will perform the best:

a. Quick sort
b. Merge sort
c. Insertion sort
d. Selection sort

User Cbp
by
3.2k points

1 Answer

6 votes

Answer:

The answer is "Option C".

Step-by-step explanation:

The array was already sorted. Much new information is applied to the array on a recurring basis at random indices, to bring everything back in order. During in the sort, I wouldn't want to use much further memory.

It is a sorting algorithm that constructs one piece at a time in the final sorted array. In large lists, it is far less effective than sophisticated technology like quicksort, heapsort, or combination sort.

User Mario Tacke
by
3.5k points