Some sort of number allocation algorithm
<p>I am creating a booking system that allows a specific number of rooms/seats to be booked. Say a user can book seats/rooms numbered 1-100. My lecturer has suggested I use an algorithm that divides the reservation numbers economically so the seats left unsold are kept to a minimum. So for instance if there was 10 seats available:</p>

<p>User 1 books 4 seat. Given (no 1-4).
User 2 books 1 seat. Given (no 5).
User 3 books 4 seats. Given (no 6-9).
User 2 then cancels. Freeing up (no 5).
User 4 then wants to book 2 seats but the only seats available are 5 &amp; 10 (Not together, so they do not book).</p>

<p>My lecturer said a common algorithm exists for this problem, but could not remember the name. I suppose it's like the algorithm used for data on a disk.</p>

<p>Any ideas?
Many thanks.</p>