4.5

From The Algorithm Design Manual Solution Wiki
Revision as of 18:21, 20 September 2020 by Algowikiadmin (talk | contribs) (Created page with "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 fre...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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


Back to Chapter 4