Three passengers are waiting for an elevator in different floors of a 6-story building. The elevator...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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 1 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. 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 1 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.
Expert Answer:
Related Book For
Statistical Techniques in Business and Economics
ISBN: 978-0078020520
16th edition
Authors: Douglas Lind, William Marchal
Posted Date:
Students also viewed these programming questions
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Doug Robinson and Dante are considering the possibility of opening their own manufacturing facility. They expect first-year sales to be $800,000, and they feel that their variable costs will be...
-
Derive the thermal force matrix for the axisymmetric element of Chapter 9. [Also see Eq. (15.1.27).]
-
After discovering a new gold vein in the Colorado mountains, CTC Mining Corporation must decide whether to go ahead and develop the deposit. The most cost effective method of mining gold is sulfuric...
-
A local theater company was seeking unpaid interns to be involved in their summer theater productions. The company hired several students from Better Business University to fill these slots. At the...
-
Invigor Corporation is an international manufacturer of fragrances for women. Management at Invigor is considering expanding the product line to mens fragrances. From the best estimates of the...
-
what happens when ou use an aggregation function in a calculated column?
-
Which court (civil or criminal) would be likely to deal with a case concerning the recovery of a debt of 10,000 when the debtor consistently refuses to pay the creditor despite the creditors multiple...
-
_______________ is the reverse of evaluation deficiency. It occurs when activities that are not part of the job are included in the evaluation. Contamination Deficiency Distortion Expansion
-
Which is an element of applying the GAO's conceptual framework (framework)? O Apply the framework when unable to comply with the rule. O Evaluate the least restrictive rules to apply to a potential...
-
Compliance strategy is one of the three strategies of - business regulation, which means setting standards for suppliers and consumers and means of assigncompliance: True or False
-
Product-design problems arise due to changing competitor coming up with a better product. a) Customer needs b) Owner needs c) Manager needs d) Supplier needs
-
Kendall, a real estate sales manager at Crawford Corp., sends all her subordinates a memo that explains the importance of real estate. In this case, Kendall is engaged in _ _ _ _ _ . a ....
-
Marathon Petroleum Inc. commenced operations on January 2, 2018, and has a year-end of December 31. It operates an oil refinery located on the Seaway and a chain of 36 gasoline stations in eastern...
-
In Exercises evaluate the limit, using LHpitals Rule if necessary. lim 07x cos x X
-
The following sample observations were randomly selected. a. Determine the regression equation. b. Determine the value of y when x is7. x. y 13 15 7 12 13 11 9 5
-
A statewide real estate sales agency, Farm Associates, specializes in selling farm property in the state of Nebraska. Its records indicate that the mean selling time of farm property is 90 days....
-
Families USA, a monthly magazine that discusses issues related to health and health costs, surveyed 20 of its subscribers. It found that the annual health insurance premiums for a family with...
-
Working in a small group, collect credit card marketing information or the summary of account information sent to cardholders for three to five different cards. Be sure to protect the identity of the...
-
Interview individuals who represent the three stages of the financial life cycle about their credit card usage. How many cards do they have? What kind or class of cards (rebate, premium, affinity,...
-
Break into two or three groups to research the use of affinity cards. First, develop a list of affinity cards and their sponsors. Does your university sponsor a card? Next, each group should choose a...
Study smarter with the SolutionInn App