4 ms·
This. I used to use it, too. We would start with trivial cases (one elevator, two stories), and gradually add more floors and elevator shafts. We never, ever go
by jes5199 15y ago
This. I used to use it, too. We would start with trivial cases (one elevator, two stories), and gradually add more floors and elevator shafts.
We never, ever got to the interesting algorithms. It took a surprisingly long for people to describe anything remotely like a working, naive algorithm.
(of course, the most simple algorithm doesn't even use a queue! It just moves the elevator up until it hits the top, and down until it hits the bottom, opening the doors wherever there's a call request)