Exercise 6 in the NTNU course TDT4280