Difference between revisions of "TADM2E 4.5"
From Algorithm Wiki
(Recovering wiki) |
(No difference)
|
Latest revision as of 18:14, 11 September 2014
O(nlogn) solution:
- sort the array first,
- scan the array, keep updating a max_so_far counter.
O(n) solution:
- put each value into hash map with the value as key and frequency as value
- scan the hash map to find the max