Its straight forward if the range of the array elements is bounded. or you
could hash a number (key) and its frequency (value) in a hash table this
would give you almost O(n) complexity.

On Mon, Aug 24, 2009 at 1:00 PM, Nagendra Kumar <nagendra....@gmail.com>wrote:

>
> Plz write the code here.
>
> On Sun, Aug 23, 2009 at 2:30 PM, Dufus<rahul.dev.si...@gmail.com> wrote:
> >
> > Idea is simple either to keep a count and emit elements with odd count
> > (frequency) or XOR element with itself for each time it occurs in
> > input and then emit elements which have non zero XORed result(which
> > basically corresponds to elements with odd frequency).
> >
> > _dufus
> >
> >
> > On Aug 23, 8:44 am, Nagendra Kumar <nagendra....@gmail.com> wrote:
> >> How are u doing with xor. Can u post ur thought here.
> >>
> >> Thanks
> >> Nagendra
> >>
> >>
> >>
> >> On Sun, Aug 23, 2009 at 2:07 AM, Dufus<rahul.dev.si...@gmail.com>
> wrote:
> >>
> >> > We can count or XOR but I couldnt find any advantage of XORing except
> >> > for preventing overflow.
> >>
> >> > _dufus
> >>
> >> > On Aug 22, 5:03 pm, Nagendra Kumar <nagendra....@gmail.com> wrote:
> >> >> I think you are trying sorting and then counting the frequency of the
> numbers.
> >>
> >> >> -Thanks
> >> >> Nagendra
> >>
> >> >> On Sat, Aug 22, 2009 at 11:21 AM, Dufus<rahul.dev.si...@gmail.com>
> wrote:
> >>
> >> >> > I can think of a naive algorithm which takes O(n) time and O(n)
> space.
> >> >> > or O(nlogn) with O(1) space.
> >>
> >> >> > May be someone else might come up with a better algo.
> >>
> >> >> > _dufus
> >>
> >> >> > On Aug 21, 3:01 pm, nagendra kumar <nagendra....@gmail.com> wrote:
> >> >> >> Given an array of integers,Print the integers whose appareance are
> in
> >> >> >> odd times.
> >> >> >> Need not worry abt order while printing the output.
> >> >> >> Need Algotithm in o(n) time complexity.
> >> >> >> Need efficient space complexity.
> >
> > >
> >
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to