S
S
Senka Chekanov2016-07-14 03:51:37
Algorithms
Senka Chekanov, 2016-07-14 03:51:37

New algorithm for finding the most frequent element, is it possible?

I seem to have come up with a new algorithm for finding the most frequent element in an array, requires O(1) memory, runs in O(N) time, and does not depend on whether the element occurs more than N/x times.
UPD. All closed :)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
sim3x, 2016-07-14
@Sencho_Pens

0. Get drunk
1. Write tests for the worst and best options
2. Write the code of the method on xs or pluses
3. Go to university with a good teacher

S
Sergey Starkov, 2016-07-14
@MrBlastark

Boyer-Moore algorithm?
https://habrahabr.ru/post/167177/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question