Question
Write a polymorphic function, howManyShuffles, which takes three parameters: a shuffle function (such as outshuffle or inshuffle), and two lists of even size. It keeps
Write a polymorphic function, howManyShuffles, which takes three parameters: a shuffle function (such as outshuffle or inshuffle), and two lists of even size. It keeps applying the shuffle function on the first of the two lists, until it becomes identical to the second list, and returns the count of the number of shuffles that were required.
As part of your testing of howManyShuffles, try to find out:
a) How many out-shuffles are required to return a stack of 52 cards to its original ordering?
b) How many in-shuffles are required to completely reverse a stack of 52 cards?
Programming language: Scala
Suffle method:
https://www.chegg.com/homework-help/questions-and-answers/write-polymorphic-function-shuffle-takes-two-lists-l1-l2-representing-decks-cards-returns--q44314636
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started