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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!