d091: Urban Transport System - PowerPoint PPT Presentation

d091 urban transport system n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
d091: Urban Transport System PowerPoint Presentation
Download Presentation
d091: Urban Transport System

play fullscreen
1 / 8
d091: Urban Transport System
76 Views
Download Presentation
kamana
Download Presentation

d091: Urban Transport System

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. d091: Urban Transport System Po-Lung Chen Team Dont Block Me, National Taiwan University March 26, 2010

  2. Problem Description (1/2) • Given information of subway lines and bus lines. • For each query find the minimum time traveling from source station to the destination station.

  3. Problem Description (2/2) • Every bus line is numbered from 1 to 99. • Every subway line is numbered from ‘A’ to ‘Z’. • The number of stations on each line . • The average transfer and waiting time:

  4. Input Specification 1 L 36 2 1 3 5 3 2 3 L K 3 5 7 6 6 3 3 3 5 1 Q 1 2 Q 1 7 E 6 The number of test cases. Bus line #36, 3 stops 1 3 2 Subway line #11, 4 stops (6->3->5->7) 5 2 Queries:1->2?1->7? End of queries 7

  5. Graph Model • We view each as a node. • If a bus/subway line (line number ) passes from station A to station B, an edge is created with its weight equals the time this bus/subway travel from A to B. • If two bus/subway line (line number ) passes same station A, then an edge created with its cost 5 or 10 according to the average waiting time.

  6. Solution • Once we constructed the graph, for each query just find the shortest path from source station (with any possible bus/subway line number) to destination. • We can use Dijkstra’s algorithm to solve this problem. • Moreover, we can use adjacent lists to store the information of nodes and edges on the graph.

  7. Analysis • The number of nodes on the graph is equal to the sum of number of stations over all bus/subway lines, which is at most . • The degree of each node is at most . • Apply Dijkstra’s Algorithm with a heap we can solve this problem in . • With a Fibonacci heap (NOT recommended), we can achieve the time complexity .

  8. Finally… Thanks for your attention!