ignore my comment... On Thu, Feb 9, 2012 at 4:15 PM, Ashish Goel <ashg...@gmail.com> wrote:
> log n is impossible. the other solution i thought was of building a tree > where each node contains value and its count. and then building a heap out > of these counts, but this will be overkill. > > the fact that rest of the n/2 elements are not unique is the killer in the > logic otherwise only n/2+1 elements are sufficient > > Best Regards > Ashish Goel > "Think positive and find fuel in failure" > +919985813081 > +919966006652 > > > > On Thu, Feb 9, 2012 at 2:53 PM, atul anand <atul.87fri...@gmail.com>wrote: > >> i guess can be done using binary indexed tree. >> >> >> On Thu, Feb 9, 2012 at 2:07 PM, Prakhar Jain <jprakha...@gmail.com>wrote: >> >>> But in this post, we don't have prior information about what can be >>> possible majority element. >>> >>> According to my question, we know that either x is the majority element >>> or there is no majority element. >>> Can we use that information to reduce complexity to O(log n)..??? >>> >>> -- >>> 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?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 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?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 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?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 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?hl=en.