Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Fill in the function in the following program so that it will return the day in range with the fewest number of scheduled events. #include

Fill in the function in the following program so that it will return the day in range with the fewest number of scheduled events.

#include

#define MAX 100

int findMinIndex(int data[], int low, int high);

int main() {

int i, loop, n, queries, data[ MAX ];

// Read in the schedule data. FILE* ifp = fopen("schedule.in", "r"); fscanf(ifp, "%d", &n);

for (i=0; i

fscanf(ifp, "%d", &data[ i ]);

// Process each query. fscanf(ifp, "%d", &queries);

for (loop=0; loop

int low, high; fscanf(ifp, "%d%d", &low, &high); printf("%d ", findMinIndex(data, [ Select->"data", "low", "high", "data[]", "&low", "&high", "*data", "*low", "*high"] , high));

}

return 0;

}

// Pre-condition: low <= high and are both valid indexes to data. // Post-condition: Returns the lowest index in [low, high] storing // the minimum of array[ low ]array[ high ]. [ Select->["int", "float", "double", "char", "void", "int *", "float *", "double *", "char *", "void *"] findMinIndex(int data[], int low, [ Select->"int low", "int *low", "int high", "int *high"] ) {

int i, res = low;

for (i =[ Select-"0", "high", "low - 1", "low + 1"] ; i [ Select -> "=", "==", ">", ">=", "<", "<=", "!="] high; i++)

if (data[ i ] < [ Select -> data", "data[low]", "data[high]", "data[res]", "data[i]"] )

res = i;

[ Select->return;", "return i;", "return res;", "return data;", "return low;", "return high;", "//no statement is needed here"]

}

There are 7 answers to select, the choices are next to "Select". The choices are in quotations.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Medical Image Databases

Authors: Stephen T.C. Wong

1st Edition

1461375398, 978-1461375395

More Books

Students also viewed these Databases questions