Hi Amir

On Fri, Jul 2, 2010 at 10:13 PM, Amir hossein Shahriari <
amir.hossein.shahri...@gmail.com> wrote:

> both problems can be done in O(n)
> pick the first two elements count the number of their appearances in the
> array ( O(n) )
> if they are not the result we now that there is an element that is repeated
> n times in 2n-1 elements and we can do the moore's algorithm for finding it
> here's a link to this algorithm:
> userweb.cs.utexas.edu/~moore/best-ideas/mjrty/index.html
>
> I didnt understand the algo correctly what is the sequence is


C C C C C A A B B A B

now the last current candidate is B 1
but B is certainly not in majority. Can you please explain that to me?




> --
> 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.
>



-- 
Best Regards
Akash Gangil

-- 
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.

Reply via email to