太久没有更新博客了,原来做的作业都没有写blog,现在印象已经有点模糊了,不过还是得贴出来,方便以后查阅。。
本次作业算是比较简单的一次。。。。
一共两道题,第一题题目要求如下:
Question 1
Download the text file
here. (Right click and save link as).
The goal of this problem is to implement a variant of the 2-SUM algorithm (covered in the Week 6 lecture on hash table applications).
The goal of this problem is to implement a variant of the 2-SUM algorithm (covered in the Week 6 lecture on hash table applications).
The file contains 1 million integers, both positive and negative (there might be some repetitions!).This is your array of integers, with the ith row of the file specifying the ith entry of the array.
Your task is to compute the number of target values t in the interval [-10000,10000] (inclusive) such that there are distinctnumbers x,y in the input file that satisfy x+y=t