lab - Homework Assignment 1 Magic of Perfect Shuffles In...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Homework Assignment 1 Magic of Perfect Shuffles In one card trick, the magician pulls out a new deck of cards and asks for a volunteer from the audience, whose name turns out to be Susan. She shuffles the deck several times, chooses one card, then shows it to the other spectators. She reassembles the deck and hands it back to the magician. The magician shuffles the cards several times, and the tells Susan that her card is the fifth card from the top. How did he do this magic trick? In this assignmnet you will discover the mathematics of the perfect shuffle. Credit to Ivars Peterson MAA Online Objectives: Review basic Java concepts Reinforce the concept of object-oriented programming; Part I: You are to implement a Java class public class PerfectShuffle that simulates shuffling a deck of n (even-!) cards. Each card is labeled with a number from 0 to n-1. A perfect shuffle is performed by splitting the deck into a top part and a bottom part and then (starting with the bottom part) repeatedly taking the bottom card from each part and placing them on top of a new deck. The process called an in-shuffle is shown for a deck of 8 cards below. initial deck:
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 12/19/2009.

Page1 / 4

lab - Homework Assignment 1 Magic of Perfect Shuffles In...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online