Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
Let if I develop an elevator (lift) system.
So which data structure we should be followed to build the system.

What I have tried:

I have googled but not get as well.
Posted
Updated 21-Sep-19 7:32am

An impossible question to answer. You create, or use existing, data structures, based on the requirements of your application.
 
Share this answer
 
Comments
verma.vivek 21-Sep-19 11:37am    
I have just asked as scenario. I have given an interview.
I have suggested one of data structure to interviewer. But might be not worthy. So if anyone answer this or any link it's would be helpful.
Dave Kreskowiak 21-Sep-19 11:40am    
There is no way to answer this question. What you should have been doing is asking the interviewer questions about the system and you build your data structure from that.
Richard MacCutchan 21-Sep-19 12:06pm    
Like I said, it is impossible to answer. The only information you have provided is that this is an elevator system. But that tells us nothing about the requirements of the system, so there is no way to give a valid response.
BillWoodruff 22-Sep-19 9:42am    
"I have suggested one of data structure to interviewer."

But, you don't tell us what that is.
verma.vivek 23-Sep-19 12:23pm    
ok, suggest me that one.
If you want to simulate an elevator, it will be a state machine that reacts to inputs (buttons, sensors) and controls outputs (motor, doors, display). A state machine isn't usually considered a data structure, however, because it will use various data structures (e.g. a queue of messages) in its implementation.
 
Share this answer
 
Quote:
Which data structure is suitable for elevator system?

There is no magic "standard data structure" that will automatically fit your lift system.
The trick is that just like with the vast majority of problems, you have to create/craft your own solution.
Remember that a data structure is never a solution to a problem, it is the combination of data structure and associated code/program that is a solution to the problem.

The general approach is to list all requirements in order of decreasing importance.
then create a data structure that fit the first requirement, and refine the data structure as you include other requirements.
You will see that as you define the data structure, you also plan how you will use it.
 
Share this answer
 
v2
There isnt an easy answer, but you may collect all data which you may need and get. Important is than to define all use cases like up or down rides and some emergency cases like overload or fire alarm. Think also about some graphical presentation like payload, state and position. This conceptional phase should be some hours and best is to use paper or UML and present your results to somebody who understands it. So you may find some flaws in your concept.

Best practice is to use some classes and enums and also use database for saving and loading the data. Some replay would be the creme on the top.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900