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: 3694894 • 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

The final array is to be considered as unsorted in this case in any type of sorting technique because

Let us assume an array A={12, 6, 11, 5, 9, 2, 4}

to arrange array A in ascending order

the following are the passes in insertion sort-

                    INSERTION SORT

12       6       11      5      9      2       4

6        12      11     5      9       2      4

6        11      12      5     9       2       4

5        6        11      12      9     2     4

5      6       9      11      12      2     4

2        5        6     9       11    12    4

2         4        5      6       9     11   12

the following is for bubble sort-

                     BUBBLE SORT

12      6      11      5     9      2      4

6        11    5       9     2      4     12

6        5       9       2     4       11    12

5       6       2      4      9      11     12

5       2        4      6     9     11    12

2        4        5      6     9       11    12

                      SELECTION SORT

12      6      11     5     9      2      4

2        6      11     5     9       12    4

2        4       11    5     9       12    6

2        4        5     11    9      12     6

2        4        5      6     9       12    11

2        4        5      6     9       11     12

By considering the case given in the question-

If a value in the Unsorted part i.e., A = { 12, 6, 11, 5, 9, 2, 4 } changes to the largest in the entire array -

let us take the value as ' 4 ' from the array A changes to largest value ' 12 ' in the entire array

then the final array is A = { 2, 12, 5, 6, 9, 11, 4 }

So, it is again an unsorted array. if the process applied to above all sorts the result will occur in unsorted way.

A memory read error is a malfunction that occurs when data is being accessed from memory for use by a program, or when a value read from RAM fails to match an expected value.

Memory read errors can cause miscalculations, program malfunctions, unresponsiveness, the blue screen of death (BSOD) and spontaneous restarts.

note- the above answer can help to answer the given question.

                    INSERTION SORT

12       6       11      5      9      2       4

6        12      11     5      9       2      4

6        11      12      5     9       2       4

5        6        11      12      9     2     4

5      6       9      11      12      2     4

2        5        6     9       11    12    4

2         4        5      6       9     11   12

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