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: 3698140 • 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: SmallCircle 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 unsorted part changes to smallest value in the entire array the final array is the list to be sorted, compares each pair of adjacent items and swaps them if they are in the wrong order.

Insertion sort(Linear) : If a value is in the unsorted part changes to the smallest value in the entire array then the final array is  sorted array (or list) one item at a time.

Selection sort (Straight) : If a value is unsorted part changes to the largest values in the entire array the the final array is next largest element in the array and move it to its final position in the sorted array

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