Algorithms 1, Princeton, tasks 1 & 2