Question: Clearly identify 2 bugs in the code below, ensuring to state the line numbers and flawed operations. 1 void sort(int arr[], int n) {
Clearly identify 2 bugs in the code below, ensuring to state the line numbers and flawed operations. 1 void sort(int arr[], int n) { 2 3 4 6 345678901 int i, key, j; for (i=1; i < n; i++) { 8 9 10 } 11} j = 11; while (j >= 0 && arr[j] > arr[i]) { } arr[j+1] = arr[j]; j = j -1; arr[j+1] = arr[i]; The function below contains errors. Identity two errors and explain how they affect the execution of the function. In your explanation, you are to assume only one error exists at a time. 1 void sort(int arr[], int n) { 2 3 4 5 6 7 8 9 10 int i, key, j; for (i = 1; i < n; i++) { ji 1; while (j = 0 && arr[j] > arr[i]) { arr[j+1] = arr[j]; j = j -1; arr[j+1] = arr[i]; } } 11}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
