Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(1) Three passengers are waiting for an elevator in different floors of a 6-story building. The elevator must stop at the floors as follows: a)

image text in transcribed
(1) Three passengers are waiting for an elevator in different floors of a 6-story building. The elevator must stop at the floors as follows: a) Passenger 1 is at 1st floor and he presses the elevator button as the first person. He wants to go to 3rd floor b) Passenger 2 is at 2nd floor and he presses the elevator button as the second person. He wants to go to 4th floor. c) Passenger I gets off the elevator when the elevator gets to 3rd floor. d) Passenger 3 is at 4th floor and he presses the elevator button as the third person. He wants to go to 1st floor. e) Passenger 2 gets off the elevator when the elevator gets to 4th floor. f) The elevator moves toward first floor where passenger 3 gets off the elevator. Write a C program that uses linked lists or stacks to pick up the passengers or drop them off at the desired floors. Draw the block diagram of your linked list or stack at each step. hint: In the beginning and at the end, the elevator is empty. hint: you can use either the floor number or the passenger number as the data member of your structure. hint: getting in to the elevator is equivalent to inserting a node and getting off the elevator is equivalent to removing a node

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M. Kroenke

1st Edition

0130086509, 978-0130086501

More Books

Students also viewed these Databases questions

Question

What Is acidity?

Answered: 1 week ago

Question

Explain the principles of delegation

Answered: 1 week ago

Question

State the importance of motivation

Answered: 1 week ago

Question

Discuss the various steps involved in the process of planning

Answered: 1 week ago

Question

What are the challenges associated with tunneling in urban areas?

Answered: 1 week ago