Solution
Keep a linked list of city records. Each record contains
the city name and a linked list of cites that are north of it.
Main
for each pair of cities (C,N)
add C to a linked list (if not there)
add the fact that C is directly south of N
for each pair of cities (C,N)
if C is south of N, then put "is south"
elsef N is south of C, then put "is north"
else "not related"
Add the fact that C is directly south of N
add N to C's list of northern cities
A recursive tree traversal:
C is south of N
for each City in the linked list
if City=C then
C is directly south of N if C is in C's list of northern cities
Otherwise, for each city in C's list of cities see if that
city is south of N
Otherwise, if C was not found in the list, then C is NOT known to be
south of N
Ryan Stansifer <ryan@cs.fit.edu>
Last modified: Mon Mar 22 10:32:28 EST 1999