12206 - HW3 Bus Route Editor   

Description

[ 一定要用自己實現的 linked list 完成! ]

A bus route editor needs to support two operations:

INSERT (src, dst, new, method)

  • src: the name of the source bus stop
  • dst: the name of the destination bus stop, which is next to the src stop
  • new: the name of the newly added bus stop
  • method:
    • 1: insert the new stop in between src-->dst
    • 2: In addition to src-->dst, also insert the same stop in between dst-->src if appropriate

DELETE (name)

  • Delete the named bus stop

Input

The first number is the number of the following operations.  Each of the following line contains an operation.

Two additional rules:

  • The bus route contains NTHU and TSMC in the beginning.
  • NTHU is never deleted

 

Output

Traverse the final bus route from NTHU and back to NTHU.

Sample Input  Download

Sample Output  Download

Tags




Discuss