Construct a frequency table from an iterable. Similar to Python's Counter class.
Counter
Time complexity: O(n)
Space complexity: O(n)
The iterable to construct a frequency table for
A frequency table represented as a Map where keys are the elements and values are the frequency
Map
frequencyTable([1, 2, 2, 3, 3, 3]) // Map(3) { 1 => 1, 2 => 2, 3 => 3 }; Copy
frequencyTable([1, 2, 2, 3, 3, 3]) // Map(3) { 1 => 1, 2 => 2, 3 => 3 };
count to count the occurrences of one value in an iterable
Iterable
Construct a frequency table from an iterable. Similar to Python's
Counter
class.Time complexity: O(n)
Space complexity: O(n)