If a train travelling from station A to E with station B, C, D in between with 2 seats (seat 1 and seat 2).
Seat 1 is not booked for the whole journey.
Seat 2 is booked from station A to B and station D to E.
Booked as ( '-' : Empty and '#' : Booked )
Seat 1 : A ---------------------------------------------------------- E
and
Seat 2 : A ############ B -------------- C ---------- D ############# E
I need a best way or an algorithm so that if a booking request comes for station B to C or C to D seat 2 should be booked by the system so that any other booking for the whole route should be allocated seat 1.
Thanks in advance!
Aucun commentaire:
Enregistrer un commentaire