#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;}______________________________________________________________________________Convert the code above into Pseudocode
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;}
______________________________________________________________________________
Convert the code above into Pseudocode
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here