Tagged articles

bucket sort

2 articles · Page 1 of 1
Ops Development & AI Practice
Ops Development & AI Practice
Sep 13, 2024 · Fundamentals

How to Find Top‑K Frequent Elements in O(n) Time Using Bucket Sort

This article explains how to efficiently find the k most frequent elements in an integer array using a bucket‑sort based algorithm that runs in linear O(n) time, detailing problem constraints, conventional O(n log n) approaches, the optimized method, Go implementation, complexity analysis, and test results.

algorithmbucket sorttime-complexity
0 likes · 7 min read
How to Find Top‑K Frequent Elements in O(n) Time Using Bucket Sort