[algogeeks] Re: test if more than half of numbers are equal

2006-02-22 Thread kool_guy
thank you! --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For

[algogeeks] Re: test if more than half of numbers are equal

2006-02-20 Thread daizi sheng
if there is an element occurring more than n/2 times in Q, we can find it as following. if x \in Q and y \in Q and x != y, we can just drop both of them and do not change the answer. so the algo. is like: c = 0 for i = 1 to n { if(c == 0) { c = 1 x = Q_i }else{ if(Q_i != x)