Interview Question and Answer: Elevator Algorithm

Dev Patterns

Image

One of the interview questions asked is “Elevator Algorithm”. As you think this problem seems easy, but you might not be easily think of the algorithm in a fast manner. I have written a simple version of it and I think this would be enough for an interview.

ElevatorCabin Class

This class is the core class that nearly all of the logic runs, so it will be enough for you to view this thorough.

ElevatorEngine Class

This class is the engine that will simulate the work of an elevator using the thread mechanism.

ElevatorEngineDriver Class

The driver classs to test the algorithm.

View original post

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s