Keep That Card in Mind: Card Guessing with Limited Memory

Authors Boaz Menuhin, Moni Naor

Thumbnail PDF


  • Filesize: 0.77 MB
  • 28 pages

Document Identifiers

Author Details

Boaz Menuhin
  • Department of Computer Science and Applied Mathematics, Weizmann Institute of Science, Rehovot, Israel
Moni Naor
  • Department of Computer Science and Applied Mathematics, Weizmann Institute of Science, Rehovot, Israel


We thank Eylon Yogev and Yotam Dikstein for many suggestions and advice. We thank Hila Dahari, Uri Feige, Tomer Grossman, and Adi Schindler for meaningful discussions and insights. We thank Samuel Spiro for his comments. We also thank Gal Vinograd for reading a preliminary version of this document.

Cite AsGet BibTex

Boaz Menuhin and Moni Naor. Keep That Card in Mind: Card Guessing with Limited Memory. In 13th Innovations in Theoretical Computer Science Conference (ITCS 2022). Leibniz International Proceedings in Informatics (LIPIcs), Volume 215, pp. 107:1-107:28, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2022)


A card guessing game is played between two players, Guesser and Dealer. At the beginning of the game, the Dealer holds a deck of n cards (labeled 1, ..., n). For n turns, the Dealer draws a card from the deck, the Guesser guesses which card was drawn, and then the card is discarded from the deck. The Guesser receives a point for each correctly guessed card. With perfect memory, a Guesser can keep track of all cards that were played so far and pick at random a card that has not appeared so far, yielding in expectation ln n correct guesses, regardless of how the Dealer arranges the deck. With no memory, the best a Guesser can do will result in a single guess in expectation. We consider the case of a memory bounded Guesser that has m < n memory bits. We show that the performance of such a memory bounded Guesser depends much on the behavior of the Dealer. In more detail, we show that there is a gap between the static case, where the Dealer draws cards from a properly shuffled deck or a prearranged one, and the adaptive case, where the Dealer draws cards thoughtfully, in an adversarial manner. Specifically: 1) We show a Guesser with O(log² n) memory bits that scores a near optimal result against any static Dealer. 2) We show that no Guesser with m bits of memory can score better than O(√m) correct guesses against a random Dealer, thus, no Guesser can score better than min {√m, ln n}, i.e., the above Guesser is optimal. 3) We show an efficient adaptive Dealer against which no Guesser with m memory bits can make more than ln m + 2 ln log n + O(1) correct guesses in expectation. These results are (almost) tight, and we prove them using compression arguments that harness the guessing strategy for encoding.

Subject Classification

ACM Subject Classification
  • Theory of computation → Adversary models
  • Adaptivity vs Non-adaptivity
  • Adversarial Robustness
  • Card Guessing
  • Compression Argument
  • Information Theory
  • Streaming Algorithms
  • Two Player Game


  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    PDF Downloads


  1. Noga Alon, Omri Ben-Eliezer, Yuval Dagan, Shay Moran, Moni Naor, and Eylon Yogev. Adversarial laws of large numbers and optimal regret in online classification, 2021. URL:
  2. Shai Ben-David, Allan Borodin, Richard M. Karp, Gábor Tardos, and Avi Wigderson. On the power of randomization in on-line algorithms. Algorithmica, 11(1):2-14, 1994. URL:
  3. Omri Ben-Eliezer, Rajesh Jayaram, David Woodruff, and Eylon Yogev. A framework for adversarially robust streaming algorithms. In PODS'20, pages 63-80, 2020. Google Scholar
  4. Omri Ben-Eliezer and Eylon Yogev. The adversarial robustness of sampling. In Proceedings of the 39th ACM SIGMOD-SIGACT-SIGAI Symposium on Principles of Database Systems, PODS'20, pages 49-62, 2020. Google Scholar
  5. Allan Borodin and Ran El-Yaniv. Online computation and competitive analysis. Cambridge University Press, 1998. Google Scholar
  6. Kai-Min Chung, Tai-Ning Liao, and Luowen Qian. Lower Bounds for Function Inversion with Quantum Advice. In 1st Conference on Information-Theoretic Cryptography (ITC 2020), volume 163, pages 8:1-8:15, 2020. Google Scholar
  7. Thomas M. Cover and Joy A. Thomas. Elements of Information Theory, 2nd Edition. Wiley, 2006. Google Scholar
  8. Persi Diaconis, Ron Graham, Xiaoyu He, and Sam Spiro. Card guessing with partial feedback. CoRR, October 2020. arXiv: 2010.05059. URL:
  9. Persi Diaconis and Ronald Graham. The analysis of sequential experiments with feedback to subjects. The Annals of Statistics, 9 (1), January 1981. Google Scholar
  10. Itai Dinur. On the Streaming Indistinguishability of a Random Permutation and a Random Function. In Advances in Cryptology – EUROCRYPT 2020, Lecture Notes in Computer Science, pages 433-460, 2020. Google Scholar
  11. Uriel Feige. A randomized strategy in the mirror game, 2019. URL:
  12. Ronald Fisher. A method of scoring coincidences in tests with playing cards. In Proceedings of the Society for Psychical Research Volume XXXIV, pages 181-185. Society of Psychical Research, July 1924. URL:
  13. Sumegha Garg and Jon Schneider. The Space Complexity of Mirror Games. In 10th Innovations in Theoretical Computer Science Conference (ITCS 2019), volume 124, pages 36:1-36:14, 2018. Google Scholar
  14. Rosario Gennaro and Luca Trevisan. Lower bounds on the efficiency of generic cryptographic constructions. In Proceedings 41st Annual Symposium on Foundations of Computer Science (FOCS `00), pages 305-313, 2000. Google Scholar
  15. Moritz Hardt and David P. Woodruff. How robust are linear sketches to adaptive inputs? In Proceedings of the Forty-Fifth Annual ACM Symposium on Theory of Computing, STOC '13, pages 121-130, 2013. Google Scholar
  16. Avinatan Hassidim, Haim Kaplan, Yishay Mansour, Yossi Matias, and Uri Stemmer. Adversarially robust streaming algorithms via differential privacy. In NeurIPS 2020, 2020. Google Scholar
  17. Joseph Jaeger and Stefano Tessaro. Tight Time-Memory Trade-Offs for Symmetric Encryption. In Advances in Cryptology – EUROCRYPT 2019, Lecture Notes in Computer Science, pages 467-497, 2019. Google Scholar
  18. Haim Kaplan, Yishay Mansour, Kobbi Nissim, and Uri Stemmer. Separating adaptive streaming from oblivious streaming, 2021. URL:
  19. Jon Kleinberg and Éva Tardos. Algorithm Design. Pearson, 2006. Google Scholar
  20. Robin A. Moser and Gábor Tardos. A constructive proof of the general lovász local lemma. J. ACM, 57(2), 2010. Google Scholar
  21. S. Muthukrishnan. Data Streams: Algorithms and Applications. Foundations and Trends in Theoretical Computer Science, 1(2):117-236, 2005. Google Scholar
  22. Mihai Pătraşcu. Cuckoo hashing, 2010. WebDiarios de Motocicleta. Blog post available at URL:
  23. George Santayana. The Life of Reason or The Phases of Human Progress: Introduction and Reason in Common Sense, Volume VII, Book One. MIT Press, 1905. Google Scholar
  24. Ido Shahaf, Or Ordentlich, and Gil Segev. An Information-Theoretic Proof of the Streaming Switching Lemma for Symmetric Encryption. In 2020 IEEE International Symposium on Information Theory (ISIT), pages 858-863, 2020. Google Scholar
  25. Edward O. Thorp. Beat the Dealer: A Winning Strategy for the Game of Twenty-One. Vintage, 1962. Google Scholar
  26. Wikipedia. Card counting - Wikipedia, the free encyclopedia, 2004. [Online; accessed 11-June-2021]. URL:
  27. David P. Woodruff and Samson Zhou. Tight bounds for adversarially robust streams and sliding windows via difference estimators, 2020. URL: