Skip to main content

All Questions

Filter by
Sorted by
Tagged with
1 vote
1 answer
302 views

Counting letter frequency in array in O(1) with hash function

I want to calculate the frequency of each character in an array. (e.g ['a', 'b', 'o', 'p'] There are several ways to do this: A Simple brute-force over the array would need $O(n^2)$ time and $O(n)$ ...
HelloWorld's user avatar