Change the code below into Pseudocode __________________________________________________________________________ #include #include int findMissingUtil(int arr[], int low, int high, int diff) { if...



Change the code below into Pseudocode



__________________________________________________________________________


#include
#include

int findMissingUtil(int arr[], int low, int high, int diff)
{

if (high <=>
return INT_MAX;


int mid = low + (high - low)/2;


if (arr[mid+1] - arr[mid] != diff)
return (arr[mid] + diff);



if (mid > 0 && arr[mid] - arr[mid-1] != diff)
return (arr[mid-1] + diff);


if (arr[mid] == arr[0] + mid*diff)
return findMissingUtil(arr, mid+1, high, diff);

return findMissingUtil(arr, low, mid-1, diff);
}


int findMissing(int arr[], int n)
{


int diff = (arr[n-1] - arr[0])/n;


return findMissingUtil(arr, 0, n-1,diff);
}


int main()
{
int arr[] = {120001, 120013, 120025, 120037, 120049, 120061,120085,120097,120109,120121};
int n = sizeof(arr)/sizeof(arr[0]);
printf("The missing element is %d", findMissing(arr, n));
return 0;
}



Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here