Interview Questions

develop a solution for an elevator system in a building having 50 floors.....

Microsoft Interview Questions and Answers


(Continued from previous question...)

36. develop a solution for an elevator system in a building having 50 floors.....

Question:
develop a solution for an elevator system in a building having 50 floors.. the main criteria is that the lift should be available all the time


maybe an answer:

MinHeap & MaxHeap: Given an elevator e(position,{up,down}). There are 4 cases:
1. elevator moves up and req <= position --> put req in MaxHeap.
2. elevator moves up and req > position --> put req in MinHeap.
3. elevator moves down and req < position --> put req in MaxHeap.
4. elevator moves down and req <= position --> put req in MinHeap.

(Continued on next question...)

Other Interview Questions