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 <anandut2...@gmail.com> 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 <cr.a...@gmail.com> 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 <sharad20073...@gmail.com>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 algoge...@googlegroups.com. >>> To unsubscribe from this group, send email to >>> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com> >>> . >>> 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 algoge...@googlegroups.com. >> To unsubscribe from this group, send email to >> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com> >> . >> 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 algoge...@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com> > . > 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 algoge...@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?hl=en.