12212 - HW3 Bus Route Editor Supporting Reverse
|
Time |
Memory |
| Case 1 |
1 sec |
32 MB |
| Case 2 |
1 sec |
32 MB |
| Case 3 |
1 sec |
32 MB |
| Case 4 |
1 sec |
32 MB |
| Case 5 |
1 sec |
32 MB |
| Case 6 |
1 sec |
32 MB |
| Case 7 |
1 sec |
32 MB |
| Case 8 |
1 sec |
32 MB |
| Case 9 |
1 sec |
32 MB |
| Case 10 |
1 sec |
32 MB |
Description


[ 一定要用自己實現的 linked list 完成! ]
這題要支援 REVERSE
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
REVERSE
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.
Tags