Answered step by step
Verified Expert Solution
Link Copied!

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.

  1. 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.
  2. 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.image text in transcribed
The parameter represents a valid deck of cards. get_big_joker_value (List[int]) -> int Return the value of the big joker (value of the highest card) for the given deck of cards. The first parameter represents a valid deck of cards. move_small_joker (List[int]) -> None This is Step 1 of the algorithm. Swap the small joker with the card that follows it. Treat the deck as circular. Note that this function doesn't return anything. The deck is to be mutated

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

4 4 8 .

Answered: 1 week ago