in reply to find maximum occuring element in a array
If you're looking for the mode of a set and you've been handed the set (meaning you weren't involved in building it) then you're going to have to iterate over each element and count. There's a quantum algorithm to do this more quickly, but the tech isn't there yet.
Why can't the elements be "put as a dictionary to set counters against them"? That's going to be the solution that most people hear will drive you towards. If you can't directly $count{thing}++ then you're going to have to $count{stringify(thing)}++ and find the mode(s) afterward.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: find maximum occuring element in a array
by capriguy84 (Novice) on Sep 07, 2011 at 16:43 UTC | |
by AR (Friar) on Sep 07, 2011 at 16:55 UTC |