Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
image text in transcribed
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

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

Fundamentals Of Database Systems

Authors: Sham Navathe,Ramez Elmasri

5th Edition

B01FGJTE0Q, 978-0805317558

More Books

Students also viewed these Databases questions

Question

10. What other issues have you found related to your primary one?

Answered: 1 week ago