Most Frequent of every N Elements in C
问题 I have a large array A of size [0, 8388608] of "relatively small" integers A[i] = [0, 131072] and I want to find the most frequently occurring element of every N=32 elements. What would be faster, A. Create an associative array B of size 131072, iterate through 32 elements, increment B[A[i]], then iterate through B, find the largest value, reset all elements in B to 0, repeat |A|/32 times. B. qsort every 32 elements, find the largest range where A[i] == A[i-1] (and thus the most frequent