Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, I need help with an algorithm to allocate rooms to people. I need to shuffle through a list of rooms to assign a room to a person and after the fourth person is assigned to the room, it should be out of the list(should be unavailable). I have not had any luck with PHP shuffling and sorting functions yet.
Any help (pointers, references, etc.) will greatly be appreciated.
Posted
Comments
RDBurmon 1-Nov-10 1:20am    
Can u give me your table stucture of following :
1) room master
2) allocated room
3) person details(room number,checkin date time, checkout date time)

1 solution

Try to simplify your process. If you have x number of rooms, simply iterate through them whenever a person needs to be allocated. Then check the currently selected room. If it is full, move on.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900