Question: 2. (8 points) Complete th s to check whether its first argument, a 2-dimensional ntains enough e code for the following findSeats function that returns

 2. (8 points) Complete th s to check whether its first
argument, a 2-dimensional ntains enough e code for the following findSeats function

2. (8 points) Complete th s to check whether its first argument, a 2-dimensional ntains enough e code for the following findSeats function that returns an integer array of numbers representing seats taken at a theater, co consecutive empty seats (the second argument) on a desired ro argument). If the desired number of consecutive empty seats are av returns the position in the row of the first available seat in the group. enough empty seats available, it returns -1. Assume an em by O and an occupied seat is represented by 1 in the seats array. The algorithm for the program is to find an empty seat in the desired row, then see if it is the first of n consecutive empty seats. Assume global integer constants ROWS and COLS exist that are the dimensions of the seats array. w (the th If there are not pty seat is represented int findseats (int seats[][ ], int empty, int row) for (int outer-0; outer i outer++) if (seats int consecutive 0; for (int inner- ;inner i inner++ if (seats [row] [inner] 0) -- else break

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!