Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Assume a memory malfunction occurs halfway through sorting an array of N unsorte

ID: 3696145 • Letter: A

Question

Assume a memory malfunction occurs halfway through sorting an array of N unsorted integers that causes just one integer value in the array to be changed and then the sort completes. What can we say about the final array after the sorting completes? Your answers should say whether or not final array is sorted and, if unsorted, describe how the array is unsorted. For example:

- Bubble Sort: If a value in the sorted part changes to the largest value in the entire array then the final array is... not sorted and only that changed value will be out of order. For each sort and circumstance specified below, finish the description of the final array after the sort completes. The sorts mentioned below are those covered in lecture (and readings) that sort the numbers in increasing order.

Bubble Sort: If a value in the UNsorted part changes to the smallest value in the entire array then the final array is...

Insertion Sort (linear): If a value in the UNsorted part changes to the smallest value in the entire array then the final array is...

Insertion Sort (linear): If a value in the sorted part changes to the smallest value in the entire array then the final array is...

Selection Sort (straight): If a value in the UNsorted part changes to the largest value in the entire array then the final array is...

Selection Sort (straight): If a value in the sorted part changes to the largest value in the entire array then the final array is...

Explanation / Answer

Bubble Sort: If a value in the UNsorted part changes to the smallest value in the entire array then the final array is... SORTED

If we insert the element at the end of the list then the list is sorted in any other position leads to unsorted arrray.

Insertion Sort (linear): If a value in the UNsorted part changes to the smallest value in the entire array then the final array is...UNSORTED

I we insert the smallest element in unsorted part makes the array unsorted , because the right end element will become small one.

Insertion Sort (linear): If a value in the sorted part changes to the smallest value in the entire array then the final array is...SORTED

if the element in sorted list that is, if only the beginning element changes to small makes the list sorted else it becomes out of order.

Selection Sort (straight): If a value in the UNsorted part changes to the largest value in the entire array then the final array is...SORTED

largest element at the end of list makes list sorted

Selection Sort (straight): If a value in the sorted part changes to the largest value in the entire array then the final array is...UNSORTED

in sorted part if we insert the largest element it becomes out of order. or unsorted.because sorted list is from left end.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote