CMU 15-112 Summer 2020: Fundamentals of Programming and Computer Science
Collab 9 (Due Mon 8-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 'collab9'
- Download collab9.go to that folder
- Edit collab9.go using VSCode
- When you are ready, submit collab9.go to Autolab. For this hw, you may submit up to 10 times, but only your last submission counts.
- Do not use sets, dictionaries, or 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. As long as you pass the test cases in the starter file you'll receive full credit during grading.
- isEquilateralTriangle(side1,side2,side3) [5pts]
Write the function isEquilateralTriangle(side1,side2,side3) that takes three sides to a triangle. The sides will be positive ints. Return True if the 3 sides make up an equilateral triangle. - carrylessAdd [10pts]
First, read the first page (page 44) from here about Carryless Arithmetic. Fun! Then, write the function carrylessAdd(x, y) that takes two non-negative integers x and y and returns their carryless sum. Here are a couple examples:carrylessAdd(785, 376) returns 51 carrylessAdd(865, 23) returns 888
Make sure you handle the case where the numbers are different lengths!
- inverseLookAndSay(a) [10 pts]
Write the function inverseLookAndSay(a) that does the inverse of the lookAndSay problem from collab4, so that, in general:inverseLookAndSay(lookAndSay(a)) == a
Or, in particular:slicesEqual(inverseLookAndSay([][]int{{2,3},{1,8},{3,-10}}, []int{3,3,8,-10,-10,-10}}
Note: Since there are no tuples in Go, this version of inverseLookAndSay runs ont 2d int slices.