Commiting exercises 3 and 4 of list #4 for Algorithms and Programming 2.