Use C++ bitset class. It requires O(MaxValue / 8) bytes to represent set of integers with maximum number is MaxValue. To find repeated number: Iterate over the array. For each number check if it is already inserted into a bitset. If yes, then we find duplicated element. Otherwise, insert current number into a set (simply set up appropriate bit in the bitset). This approach is O(n).
On 20 окт, 14:35, Asquare <[email protected]> wrote: > @juver++ - could u plz elaborate.. -- 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?hl=en.
