issingUtil(int arr[], int low, int high, int diff) {    if (high <= low) return INT_MAX;       int mid = low + (high - low)/2;       if (arr[mid+1] - arr[mid]

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

#include <stdio.h>
#include <limits.h>
  
int findMissingUtil(int arr[], int low, int high, int diff)
{
  
if (high <= low)
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

Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education