M
murali@pune
Hi,
I have an array of 1001 integers. The integers are in random order, but
I know each of the integers is between 1 and 1000 (inclusive). In
addition, each number appears only once in the array, except for one
number, which occurs twice. Assume that I can access each element of
the array only once.
Here I need an algorithm to find the repeated number. If I used
auxiliary storage in my algorithm, can you find an algorithm that does
not require it?
I have an array of 1001 integers. The integers are in random order, but
I know each of the integers is between 1 and 1000 (inclusive). In
addition, each number appears only once in the array, except for one
number, which occurs twice. Assume that I can access each element of
the array only once.
Here I need an algorithm to find the repeated number. If I used
auxiliary storage in my algorithm, can you find an algorithm that does
not require it?