E-mail: editor@ijimt.org
Manuscript received July 26, 2023; revised August 13, 2023; accepted August 31, 2023; published February 20, 2024
Abstract—As part of a Technical and Scientific Project offered to L2 students of ISEP over a period of four months at the rate of one hour per week supervised, a study of the composition and the total number of all riffle shuffles used in magic was requested. The riffle shuffle consists of taking a deck of cards, cutting it into any two parts, then inserting randomly the cards of the first packet into the second. In first approximation there are 52! possible riffle shuffles. This number is an upper limit since the cards in a subdeck cannot change their relative position to their neighbours. A card A below a card B in the same subdeck will not be able to find itself above in the final shuffle. The first goal of the project is to compare one single algorithm implemented either recursively or iteratively in terms of execution time depending on the number of cards. The second goal is to compare the implementation of the same algorithm (either iterative or recursive) in several different programming languages (Python, Language C, Matlab, etc.) and to compare execution times according to the used language. Thus, a recursive algorithm was proposed to the students. All the students tried to code this algo and make it iterative … except one! He imagined another algorithm. The algorithm of the student and the teacher were compared in terms of execution time: do the student exceed the master? The aim of this article is to share my experience. I leave it to you to imagine educational sequences around this project in adequacy with your desires and the level of your students.
Keywords—informatics langage, magic, riffle shuffle, Matlab, C, Python, recursive algorithm, iterative algorithm, higher education
Cite: Pierre Schott and Zhenghan Pei, "Comparison and Efficiency of Different Algorithms to Count and Determine the Composition of All Possible Riffle Shuffles Used in Magic," International Journal of Innovation, Management and Technology vol. 15, no. 1, pp. 11-17, 2024.
Copyright © 2024 by the authors. This is an open access article distributed under the Creative Commons Attribution License which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited (CC BY 4.0).