The check-in and check-out times of each guest for a hotel are given as input. You need to output the maximum number of guests staying at a time at the hotel. [Hint]: Sort the check-in array Sort the check-out array Merge the sorted arrays Keep track of the number of guests at the hotel during each iteration. To do this traverse the merged array. When someone check-ins, guest count increases by one, when someone check-outs, guest count decreases by one. And also keep track of the maximum number at any time Sample Input Check-in times
The check-in and check-out times of each guest for a hotel are given as input. You need to output the maximum number of guests staying at a time at the hotel. [Hint]: Sort the check-in array Sort the check-out array Merge the sorted arrays Keep track of the number of guests at the hotel during each iteration. To do this traverse the merged array. When someone check-ins, guest count increases by one, when someone check-outs, guest count decreases by one. And also keep track of the maximum number at any time Sample Input Check-in times
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
Related questions
Question
The check-in and check-out times of each guest for a hotel are given as input. You need to output the maximum number of guests staying at a time at the hotel.
[Hint]:
- Sort the check-in array
- Sort the check-out array
- Merge the sorted arrays
- Keep track of the number of guests at the hotel during each iteration. To do this traverse the merged array. When someone check-ins, guest count increases by one, when someone check-outs, guest count decreases by one.
- And also keep track of the maximum number at any time
-
Sample Input
Check-in times
Check out times
Sample Output
{2.00, 2.10, 3.00, 3.20, 3.50, 5.00}
{2.30, 3.40, 3.20, 4.30, 4.00, 5.20}
2
{9.00, 9.40, 9.50, 11.00, 15.00, 18.00}
{9.10, 12.00, 11.20, 11.30, 19.00, 20.00}
3
Your answer
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps
Knowledge Booster
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.Recommended textbooks for you
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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education