/Hotel-Accomodation

Allocating Rooms to a person in hotel

Primary LanguageC++

Hotel-Accomodation

Problem Statement:

  • There are a given number of rooms in a building with different maximum capacity. Every person who enters into a building is provided with a unique identification number and should be sent to a room based on the Identification number of that person. Every room has a maximum capacity and a list of people in the room.Write a code for the following operations:
  • 1 - Allotting a room to a person using Linear Probing
  • If the person already has a room allotted -- print ‘-1’
  • If all the rooms in the hotel are filled -- print ‘-1’
  • 2 - Search
  • If there is no person in the building with that ID -- print ‘-1’
  • Else print ID of all the persons sharing the room with him including him (Print the IDs in the order of allocation)
  • Hashfunction= ID % No_of_rooms