CS212 Exams
Spring 1999 - Prelim
2

OO Programming III


We say that there is a path from a file system object X to a file system object Y if either:

  1. X and Y are the same object
  2. X is a directory and contains some file system object Z such that there is a path from Z to Y, or else
  3. X is a symbolic link and refers to an object Z such that there is a path from Z to Y.

Assume that, as in a real file system, each object can appear in at most one directory but may be referenced by any number of symbolic links. Write a function has-path? which when given two file system objects, returns #t if there is a path between the objects and #f otherwise.


Solution

Return to CS 212 Prelim 2 - Spring 1999