Question
(P8.1.7.) Suppose we have a length-n vector and that n is a multiple of k.In a perfect k-shuffle we reorder the components by dealing out
(P8.1.7.) Suppose we have a length-n vector and that n is a multiple of k.In a perfect k-shuffle we reorder the components by dealing out the cards to k players and then reassemble the deck, putting Player 1s cards first, Player 2s cards second, etc. For example, if n = 12, k = 4, and x= A B C D E F G H I J K L then y= A E I B F J C G K D H L is its perfect 4-shuffle. Notice that in a perfect k-shuffle, Player i receives cards i, i + k, i + 2k, etc.
(a) Write a function in MATLAB y = Perfect k Shuffle(x,k) that performs this permutation on x. Do not use reshape.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered 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