Given a collection of elements (search words, hashtags, book titles, event keys, etc.) each associated with a count or frequency, find the top K most frequent elements and return them in descending order of frequency. Variants include: (1) standard top-K from a static dataset; (2) a stateful 'bestSellers' system where…