Knuth's Elevator algorithm
The elevator algorithm, a simple algorithm by which a single elevator can decide where to stop, is summarised as follows:
1. Continue travelling in the same direction while there are remaining requests in that same direction.
2. If there are no further requests in that direction, then stop and become idle, or change direction if there are requests in the opposite direction.
The elevator algorithm has found an application in computer operating systems as an algorithm for scheduling hard disk requests.
Modern elevators use more complex heuristic algorithms to decide which request to service next.