Railway Seat Allocation — a berth is an interval, not a seat
Watch one berth get sold to two passengers at once, then watch a cancellation ripple down the waiting list.
💡
THE BIG IDEA
Ask most people how a train books seats and they will describe a counter going down. That model is wrong, and it would leave half of Indian Railways empty. A berth is not one unit of inventory — it is a strip of legs between stations, and any passengers whose journeys do not overlap can share it. Everything hard about this system, from availability to double-booking to RAC, follows from that one idea.
Press ▶ Play to watch it run step by step, or use the arrow buttons to go at your own pace.
1
An empty coach. Five berths, and a route with three legs between Chennai and Bengaluru.
Look at each berth as a bar split into three parts, one per leg — not as a single seat. That one change in how you see it is the whole lesson.
🚆
MAS
KPD
JTJ
SBC
B1
Lower
empty berth
B2
Middle
empty berth
B3
Upper
empty berth
B4
Lower
empty berth
B5
Upper
empty berth
RAC — SIDE BERTH, SHARED BY TWO
R1
Side Lower · shared
empty berth
🎟️ Book your own ticket — see where the algorithm puts you
→
Representative architecture. Indian Railways does not publish its allocation algorithm. This is a teaching model that reproduces the real shape of the problem — berths as intervals over legs, best-fit placement, RAC and waitlist promotion — not CRIS internals. Coach size and quota split are simplified so the whole coach fits on one screen.