[algogeeks] Re: Problem

2006-11-07 Thread shisheng li
Can the 4 overlap? From: algogeeks@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of mohamad momenian Sent: Tuesday, November 07, 2006 4:09 PM To: algogeeks@googlegroups.com Subject: [algogeeks] Problem Hi i have a problem please help me The input

[algogeeks] Re: majority element

2006-11-01 Thread shisheng li
I think the straightforward method it as followed: Suppose n = 2, m = 7 Check the 2-th ,4-th,6-th elements For general n m, there will be at most m/n such elements, by check them one by one, u just need O(m/n * m) time If n = theta(m), of course, the algorithm is O(m). Otherwise, if n m,