Algorithms for discrete quadratic time: frequency distributions