Candidate: You must prepare your solution to this programming exercise in advance. The designated platform, on which your solution must be demonstrated and on which it will be marked, is the `gcc' compiler running on `Linux'. If you develop a solution on another platform, it is your responsibility to ensure that it works correctly on the designated platform. Read the information under the [prac' guide], [on C and code modularity] and [plagiarism] links on the subject home page.
Groups: Note that different prac'-groups might be set different tasks. Make sure that you do your task. You will get zero marks if you solve the wrong problem.
Extend your program from [prac4] as follows:
A [topological sort] of an acyclic graph is an ordering of the vertices of the graph such that the edges all point forwards in the ordering.
Task: Extend your program so that it prints the event-descriptions in a topologically sorted order. This would be one possible way of telling the story in a linear way, without "flash-backs". (Any topological sort of the events will do.)
Extend your program from [prac4] as follows:
After reading the number, `r', of a given page,
your program must print the most distant page
that is accessible by following a path of links from `r'.
i.e. it must print the page, `d', which has
the largest (finite), shortest-distance from r.
Print d, d's description, the distance,
e.g. You might adapt Dijkstra's or Floyd's [algorithms].