Bessie has a deck of 5 cards initially ordered as [1, 2, 3, 4, 5]. Her shuffle is on 3 cards and has the effect of moving the top card to the bottom. There are 5 queries querying each position in the deck.
The shuffle proceeds as:
[1, 2, 3, 4, 5] -> [2, 3, 1, 4, 5] (put 2 face down)
[3, 1, 4, 5] -> [1, 4, 3, 5] (put 1 face down)
[4, 3, 5] -> [3, 5, 4] (put 3 face down)
[5, 4] (put 5 face down)
[4] (put 4 face down)
This produces the final order of [4, 5, 3, 1, 2]
贝西的五张牌刚开始顺序为 [1, 2, 3, 4, 5]。她一次洗三张牌,效果是将第一张牌放到底部。以上五个问题询问了每一张牌的位置。
洗牌的顺序是:
[1, 2, 3, 4, 5] -> [2, 3, 1, 4, 5] (将2正面向下放置)
[3, 1, 4, 5] -> [1, 4, 3, 5] (将1正面向下放置)
[4, 3, 5] -> [3, 5, 4] (将3正面向下放置)
[5, 4] (将5正面向下放置)
[4] (将4正面向下放置)
这就形成了最终的顺序:[4, 5, 3, 1, 2]