if space complexity is O(1) then hash map will not work.. On Wed, Jul 7, 2010 at 10:54 AM, Ashish Goel <[email protected]> wrote:
> have a hash map trace through all the elements to store the count > > now trace through the array again and return the element whose count is > found to be 2 as the first repeating element > > > Best Regards > Ashish Goel > "Think positive and find fuel in failure" > +919985813081 > +919966006652 > > > > On Wed, Jul 7, 2010 at 10:23 AM, Anand <[email protected]> wrote: > >> Since we know the range of numbers in an array. Counting sort is a trivial >> solution for it >> >> >> On Tue, Jul 6, 2010 at 9:48 PM, Anil C R <[email protected]> wrote: >> >>> do you need an algorithm which is O(1) in space? if not it's trivial. >>> Anil >>> >>> >>> >>> On Tue, Jul 6, 2010 at 7:29 PM, sharad kumar >>> <[email protected]>wrote: >>> >>>> Given an array of n numbers in which all the members are less than or >>>> equal to k (k<n). device an algorithm of order O(k) to find the first >>>> repeating element >>>> >>>> -- >>>> 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]<algogeeks%[email protected]> >>>> . >>>> For more options, visit this group at >>>> http://groups.google.com/group/algogeeks?hl=en. >>>> >>> >>> -- >>> 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]<algogeeks%[email protected]> >>> . >>> For more options, visit this group at >>> http://groups.google.com/group/algogeeks?hl=en. >>> >> >> -- >> 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]<algogeeks%[email protected]> >> . >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > -- > 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]<algogeeks%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- Thanks & Regards Umesh kewat -- 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.
