Top K Frequent Elements problem
Given an integer array nums and an integer k, return the k most frequent elements. You may return the answer in any order.
Algorithm Introduction
The bfprt algorithm is used to find the smallest k element in the array. The bfprt algorithm can find the answer in O(n) time.

Blum M, Floyd R W, Pratt V R, et al. Time bounds for selection[J]. J. Comput. Syst. Sci., 1973, 7(4): 448-461.
Top K Frequent Elements problem
Given an integer array nums and an integer k, return the k most frequent elements. You may return the answer in any order.
Algorithm Introduction
The bfprt algorithm is used to find the smallest k element in the array. The bfprt algorithm can find the answer in O(n) time.
Blum M, Floyd R W, Pratt V R, et al. Time bounds for selection[J]. J. Comput. Syst. Sci., 1973, 7(4): 448-461.