@dave akash said " >Can you please tell me why you chose a bst, simply traversing the array and incrementing the count would >have also worked in this case and it would have been O(n). " so .. if the range will be high suppose there r few numbers which are very large so taking an auxillary array and incrementing count will waste a lot of memory....
On Fri, Jul 2, 2010 at 11:13 PM, Dave <[email protected]> wrote: > @Jalaj. I don't understand how your comment contributes to the > discussion. Please explain. > > Dave > > On Jul 2, 10:56 am, jalaj jaiswal <[email protected]> wrote: > > for count suppose if there are very big numbers ..then space will nt be > > efficient > > > > > > > > > > > > On Fri, Jul 2, 2010 at 7:05 PM, saurabh gupta <[email protected]> wrote: > > > @Dave, > > > for 2n+1 you can have a configuration where repeated nos may not be > > > adjacent > > > you need a block of 3 instead of 2. > > > > > On Fri, Jul 2, 2010 at 6:04 PM, Dave <[email protected]> wrote: > > > > >> For problem 1, finding a number that is repeated just once is enough. > > >> Scan the array to see if there are two adjacent numbers that are > > >> equal. If so, that is your repeated number. Otherwise, look for the > > >> repeat in the first 5 numbers. O(n). > > > > >> Dave > > > > >> On Jul 1, 11:43 am, sharad <[email protected]> wrote: > > >> > 1.an array of 2n+1 elements is given .....one element is repeated n > > >> > times > > >> > and rest all are different.....find the no repeated. > > >> > 2.same question as above but this time other no's are not > > >> > different ..i.e > > >> > they can repeat. > > > > >> -- > > >> 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]> > <algogeeks%2bunsubscr...@googlegroups.com> > > >> . > > >> For more options, visit this group at > > >>http://groups.google.com/group/algogeeks?hl=en. > > > > > -- > > > Man goes to doctor. Says he's depressed. Says life seems harsh and > cruel. > > > Says he feels all alone in a threatening world where what lies ahead is > > > vague and uncertain. Doctor says "Treatment is simple. Great clown > > > Pagliacci is in town tonight. Go and see him. That should pick you up." > Man > > > bursts into tears. Says "But, doctor...I am Pagliacci." > > > > > -- > > > 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]> > <algogeeks%2bunsubscr...@googlegroups.com> > > > . > > > For more options, visit this group at > > >http://groups.google.com/group/algogeeks?hl=en. > > > > -- > > With Regards, > > Jalaj Jaiswal > > +919026283397 > > B.TECH IT > > IIIT ALLAHABAD- Hide quoted text - > > > > - Show quoted text - > > -- > 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. > > -- With Regards, Jalaj Jaiswal +919026283397 B.TECH IT IIIT ALLAHABAD -- 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.
