Add code to delete dynamically allocated memory
Final version hw1