CMU 15-112 Summer 2020: Fundamentals of Programming and Computer Science
Collab 10 (Due Tue 9-Jun, at 11:59pm)
- This assignment is COLLABORATIVE. This means you may work with your week's collaboration group within the course collaboration boundaries. See the syllabus for details.
- To start:
- Create a folder named 'collab10'
- Create a file named collab10.go in that folder. You should look to collab9.go for guidance on setting up your starter file. We're also happy to help you set up in small groups!
- Edit collab10.go using VSCode
- When you are ready, submit collab10.go to Autolab. For this hw, you may submit up to 10 times, but only your last submission counts.
- Do not use recursion in this assignment.
- Do not hardcode the test cases in your solutions.
- NOTE: This homework may be graded for style. Make sure that you adhere to the style guide when you're working on this HW, and double check your file against the style guide before you submit to Autolab!
- NOTE: For the next few days, assignments in Go will be manually graded.
- getPairSum(a []int, target int) []int [20pts]
In Go, write the function getPairSum from here. The function should take in an integer slice and an integer and return an integer slice of length 2. Like the linked writeup says, you should write two versions: one that runs in O(n**2) time and one than runs in O(n) time. - movieAwards [20pts]
In Go, write the function movieAwards from here. Rather than taking in a list of tuples, the function will take in a slice of winner structs. Winner structs look like this:type Winner struct { Category string Movie string }So the function signature for movieAwards should befunc movieAwards(winners []Winner) map[string]int