Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Rather than use actual card ranks and suits, we're going to use the integers from 1 to the number of cards (for English, 1 to
Rather than use actual card ranks and suits, we're going to use the integers from 1 to the number of cards (for English, 1 to 28). We will call the cards with the two highest values jokers (for English, the jokers are the cards with numbers 27 and 28). In our program, we will represent the cards as a list of integers. The top card of the deck will be at index 0.
- Find the small joker in the deck. (The small joker is the card with the second highest value, which is 27 in our context.) Swap this card with the card that is directly under it in the deck, so that the small joker moves down one position. If the small joker was found to be at the bottom of the deck, then instead swap the small joker with the top card. It may helpto think of the deck as being circular so that the card "under" the bottom card is the top card.
- Find the big joker in the deck. (The big joker is the card with the highest value, which is 28 in our context.) Move the big joker two cards down the deck by performing two card swaps. As before, think of the deck as being circular.
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