Finished answer for exercise 1 in data structures