PAT 1034 Head of a Gang (30分) 图的连通分量 + DFS
One way that the police finds the head of a gang is to check people's phone calls. If there is a phone call between A and B, we say that A and B is related.
PAT 1030 Travel Plan (30分) Dijstra +Dfs
A traveler's map gives the distances between cities along the highways, together with the cost of each highway. Now you are supposed to write a program to help a traveler to decide the shortest path between his/her starting city and the destination.