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
Chapter8: Arrays
Section: Chapter Questions
Problem 9PE
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
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning