benedeki / OccurrenceCounter

OccurrenceCounter is generic class that serves the purpose of continuously counting the number of occurrences of item kinds. The class is able to return the top and bottom items at any moment; top being the items with the highest occurrence count, bottom with the lowest.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Occurrence Counter

OccurrenceCounter is generic class that serves the purpose of continuously counting the number of occurrences of item kinds. The class is able to return the top and bottom items at any moment; top being the items with the highest occurrence count, bottom with the lowest.

The adding of an item to the counter is done in constant time, therefore adding a sequence of items is cost linear time in the context of sequence length. Getting the bottom and top items is effectively equal to creating a sequence of the given size.

About

OccurrenceCounter is generic class that serves the purpose of continuously counting the number of occurrences of item kinds. The class is able to return the top and bottom items at any moment; top being the items with the highest occurrence count, bottom with the lowest.

License:Creative Commons Attribution 4.0 International


Languages

Language:Scala 100.0%