Skip to main content

Finding Mode Using Equality Comparisons

  • Conference paper
WALCOM: Algorithms and Computation (WALCOM 2016)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 9627))

Included in the following conference series:

  • 553 Accesses

Abstract

We consider the problem of finding the mode (an element that appears the maximum number of times) in a list of elements that are not necessarily from a totally ordered set. Here, the relation between elements is determined by ‘equality’ comparisons whose outcome is \(=\) when the two elements being compared are equal and \(\ne \) otherwise. In sharp contrast to the \(\varTheta (\frac{n\lg n}{m})\) bound known in the classical three way comparison model where elements are from a totally ordered set, a recent paper gave an \(O(\frac{n^2}{m})\) upper bound and \(\varOmega (\frac{n^2}{m})\) lower bound for the number of comparisons required to find the mode, where m is the frequency of the mode. While the number of comparisons made by the algorithm is roughly \(\frac{n^2}{m}\), it is not clear how the necessary bookkeeping required can be done to make the rest of the operations take \(\varTheta (\frac{n^2}{m})\) time.

In this paper, we give two mode finding algorithms, one taking at most \(\frac{2 n^2}{m}\) comparisons and another taking at most \(\frac{3n^2}{2m} + O(\frac{n^2}{m^2})\) comparisons. The bookkeeping required for both the algorithms are simple enough to be implemented in \(O(\frac{n^2}{m})\) time. The second algorithm generalizes a classical majority finding algorithm due to Fischer and Salzberg.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Similar content being viewed by others

References

  1. Alonso, L., Reingold, E.M., Schott, R.: The average-case complexity of determining the majority. SIAM J. Comput. 26, 1–14 (1997)

    Article  MathSciNet  MATH  Google Scholar 

  2. Alonso, L., Reingold, E.M., Schott, R.: Determining the majority. Inf. Process. Lett. 47, 253–255 (1993)

    Article  MathSciNet  MATH  Google Scholar 

  3. Alonso, L., Reingold, E.M., Schott, R.: Analysis of Boyer and Moore’s MJRTY. Inf. Process. Lett. 113, 495–497 (2013)

    Article  MATH  Google Scholar 

  4. Blum, M., Floyd, R.W., Pratt, V.R., Rivest, R.L., Tarjan, R.E.: Time bounds for selection. J. Comput. Syst. Sci. 7(4), 448–461 (1973)

    Article  MathSciNet  MATH  Google Scholar 

  5. Boyer, R.S., Moore, J.S.: MJRTY—a fast majority vote algorithm. In: Boyer, R.S. (ed.) Essays in Honor of Woody Bledsoe. Automated Reasoning Series, vol. 1, pp. 105–117. Springer, Netherlands (1991)

    Chapter  Google Scholar 

  6. Dobkin, D.P., Munro, J.I.: Determining the mode. Theor. comput. sci. 12, 255–263 (1980)

    Article  MathSciNet  MATH  Google Scholar 

  7. Fischer, M.J., Salzberg, S.L.: Solution to problem 81–5. J. Algorithms 3, 376–379 (1982)

    Google Scholar 

  8. Jayapaul, V., Munro, J.I., Raman, V., Satti, S.R.: Sorting and selection with equality comparisons. In: Dehne, F., Sack, J.-R., Stege, U. (eds.) WADS 2015. LNCS, vol. 9214, pp. 434–445. Springer, Heidelberg (2015)

    Chapter  Google Scholar 

  9. Knuth, D.E.: The Art of Computer Programming. Sorting and Searching, vol. III. Addison-Wesley, Reading (1973)

    MATH  Google Scholar 

  10. Munro, J.I., Spira, P.M.: Sorting and searching in multisets. SIAM J. Comput. 5(1), 1–8 (1976)

    Article  MathSciNet  MATH  Google Scholar 

  11. Misra, J., Gries, D.: Finding repeated elements. Sci. Comput. Program. 2(2), 143–152 (1982)

    Article  MathSciNet  MATH  Google Scholar 

  12. Reingold, E.M.: On the optimality of some set algorithms. J. ACM 19(4), 649–659 (1972)

    Article  MathSciNet  MATH  Google Scholar 

  13. Saks, M.E., Werman, M.: On computing majority by comparisons. Combinatorica 11(4), 383–387 (1991)

    Article  MathSciNet  MATH  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Varunkumar Jayapaul .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2016 Springer International Publishing Switzerland

About this paper

Cite this paper

Jayapaul, V., Raman, V., Satti, S.R. (2016). Finding Mode Using Equality Comparisons. In: Kaykobad, M., Petreschi, R. (eds) WALCOM: Algorithms and Computation. WALCOM 2016. Lecture Notes in Computer Science(), vol 9627. Springer, Cham. https://doi.org/10.1007/978-3-319-30139-6_28

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-30139-6_28

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-30138-9

  • Online ISBN: 978-3-319-30139-6

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics