The mode of a sequence of numbers is defined as the most frequently occurring number in the sequence. A naïve algorithm with two nested loops finds the mode with the complexity of O (n2). We can also find the mode by sorting the elements and making one pass through the sorted sequence - a complexity of O (n log n). In this paper, we study the so-called Tournament Method and describe a variation of it that finds the mode of n numbers with O (n) complexity, if it is guaranteed that the mode has frequency at least (n/2) +1 time. We present a recursive enhancement of the tournament method for the case where the mode repeats (n/a) +1 times where a is an integer greater than 2.
cited By 0
R. Viswanath and Nandakumar, R., “The mode from a sequence of numbers”, International Journal of Control Theory and Applications, vol. 9, pp. 6675-6682, 2016.