Skip to content

Latest commit

 

History

History
23 lines (15 loc) · 1020 Bytes

README.md

File metadata and controls

23 lines (15 loc) · 1020 Bytes

Ranged2Sum

This is the solution to the 2Sum assignment of the course Algorithms Design and Analysis 1 by Tim Roughgarden. The exercise does not ask for the implementation of the standard 2Sum problem, however for a more slightly altered version in which the algorithm must search for all possible sums within a range. Currently, the range is hardcoded and is [-10000, 10000]. Also, it is important that the solutions discovered are unique. So that means that in order to lower the running time, instead of doing a naive solution

Run

go run main.go

Should print something like "There are 1000 sums"

--debug: get all the output

--intfile=/path/to/intfile : path to file that contains all the integers that will be processed

##Disclaimer

I have posted this solution here for anyone who needs a little bit of help. There is absolutely no reason to start the course and then go around and download the solutions to all the assignments. Use this to get inspiration or to check the results of your own solution.