令人頭痛的演算法題

edianpop發表於2006-10-25
Given an array of integers stored in a file with one number per line,
find all the pairs of integers that add up to 8. The output will also needs
to be stored in a file with one pair per line.
>
> An example input array looks like this:
> 3
> 2
> 4
> 6
> 5
> 7
> 20
> 1
>
> The output will be like this:
> 3 5
> 2 6
> 7 1
>
>You need to do the following.
>
>a) Write a simple design document to outline your approach.
>
>b) Write a java program to implement your design with proper comments.
Please note that the input array of integers might be very large. For
example, what about 10 million numbers? Also, what about there are some
negative numbers?
>
>c) Write some junit test cases so that someone else could test your
program.

相關文章