ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 103 Weeks Ago, 3 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 26 May 2017 My Price 9.00

91.102Program 2Adams Spring 2016Ferry

This is question about Ferry loading (search "UVA 11034", you can get information.) You have to use C programming and queue data structure using doubly linked list.

 

91.102Program 2Adams Spring 2016Ferry LoadingBefore bridges were common, ferries were used to transport cars across rivers. Riverferries, unlike their larger cousins, run on a guide line and are powered by the river'scurrent. Cars drive onto the ferry from one end, the ferry crosses the river, and thecars exit from the other end of the ferry.There is anl-meter-long ferry that crosses the river. A car may arrive at either riverbank to be transported by the ferry to the opposite bank. The ferry travelscontinuously back and forth between the banks so long as it is carrying a car or thereis at least one car waiting at either bank. Whenever the ferry arrives at one of thebanks, it unloads its cargo and loads up cars that are waiting to cross as long as theyfit on its deck. The cars are loaded in the order of their arrival and the ferry's deckaccommodates only one lane of cars. The ferry is initially on the left bank where ithad mechanical problems and it took quite some time to fix it. In the meantime, linesof cars formed on both banks that wait to cross the river.The first line of input containsc, the number of test cases. Each test case beginswith the numberl,a space and then the numberm.mlines follow describing the carsthat arrive in this order to be transported. Each line gives the length of a car (incentimeters), and the bank at which the car arrives ("left" or "right").For each test case, output one line giving the number of times the ferry has to crossthe river in order to serve all waiting cars.Sample input420 4380 left720 left1340 right1040 left15 4380 left720 left1340 right1040 left15 4380 left720 left1340 left1040 left15 4380 right720 right1340 right

Attachments:

Answers

(11)
Status NEW Posted 26 May 2017 09:05 AM My Price 9.00

-----------

Attachments

file 1495790075-Solutions file 2.docx preview (51 words )
H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly -----------onl-----------ine----------- an-----------d g-----------ive----------- yo-----------u e-----------xac-----------t f-----------ile----------- an-----------d t-----------he -----------sam-----------e f-----------ile----------- is----------- al-----------so -----------sen-----------t t-----------o y-----------our----------- em-----------ail----------- th-----------at -----------is -----------reg-----------ist-----------ere-----------d o-----------n -----------THI-----------S W-----------EBS-----------ITE-----------. ----------- Th-----------ank----------- yo-----------u -----------
Not Rated(0)