Sample solutions and grading discussion:

To some extent this question had to be marked all together -- not separate grading for parts 'a' and 'b'.

The question was about the termination requirement, not other aspects of an algorithm, such as ambiguity. Some students complained that this algorithm was ambiguous, and then gave more-specific instructions. First of all, whether this is ambiguous depends on what surrounding assumptions we have -- if this occurs amidst other instructions, it might be clear which street we're talking about, etc. But most of all, the question didn't ask about that.

The basic answer is that it would not terminate if followed in the case that there is no white building on the left; and to repair it, we could insert an additional condition which definitely limits the duration of the loop, e.g. "walk down the street until either you see a white building on the left or ten million years have elapsed".

Some students suggested repairing the algorithm by making it do something entirely different, and they did not get full marks. E.g. if there is a white building on the left, then go into it, else do nothing. (As opposed to walking down the street to the desired building.)

Worth part marks but not full marks were algorithm modifications such as "walk down the street for 58 seconds", assuming that this was how long it would take to get to the white building in question. This is a good idea, but presumably the algorithm was stated as it is because we did not know exactly how long it would take the person (or robot) to get to the white building, like in the case where we are giving this algorithm to someone when they ask for directions.


(press 'back' in your web browser to get back to where you were in the exam)