• ISSN: 2010-0248 (Print)
    • Abbreviated Title: Int. J. Innov.  Manag. Technol.
    • Frequency: Quarterly
    • DOI: 10.18178/IJIMT
    • Editor-in-Chief: Prof. Jin Wang
    • Managing Editor: Ms. Nancy Y. Liu
    • Abstracting/ Indexing: Google Scholar, CNKI, Ulrich's Periodicals Directory,  Crossref, Electronic Journals Library.
    • E-mail: ijimt@ejournal.net
IJIMT 2024 Vol.15(1): 11-17
doi: 10.18178/ijimt.2024.15.1.956

Comparison and Efficiency of Different Algorithms to Count and Determine the Composition of All Possible Riffle Shuffles Used in Magic

Pierre Schott* and Zhenghan Pei
LISITE, Institut Supérieur d’Electronique de Paris (ISEP), Paris, France
Email: pierre.schott@isep.fr (P.S.); zhenghan.pei@eleves.isep.fr (Z.P.)
*Corresponding author

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

[PDF]

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).

Copyright © 2010-2024. International Journal of Innovation, Management and Technology. All rights reserved.
E-mail: ijimt@ejournal.net
Published by International Association of Computer Science and Information Technology (IACSIT Press)