On Aug 24, 1:00 am, wbspresslyjr <[EMAIL PROTECTED]> wrote:
> I've heard this problem stated as such: assume you have an array of N
> numbers, each ranging on the interval [1,N-1], only one of these
> elements repeating in Read-Only memory. You only have O(1) (constant)
> "scratch" space to work with, and you need the algorithm to run in
> O(n) time.
That is not how the problem was presented, and as such, is not a valid
approach.
As the problem is stated you may have an array such as [100, 2, 2]
which obviously shoots your solution in the foot.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---