当前位置:   article > 正文

CSE101 C++ Introduction to Data Structures and Algorithms

CSE101 C++ Introduction to Data Structures and Algorithms
CSE 101
Introduction to Data Structures and Algorithms
Programming Assignment 5
In this project you will create a new, and somewhat different integer List ADT, this time in C++. You will use this List to perform shuffling operations, and determine how many shuffles are necessary to bring a List  back into its original order. Begin by carefully reviewing Queue and Stack examples posted on the webpage  in Examples/C++. These examples establish our norms and conventions for building ADTs in the C++  language. Also read the handout ADTs in C++ . The header file List.h has also been posted at
Examples/pa5, along with a test client, some output files and a Makefile for this project.
The Perfect Shuffle
A perfect shuffle (also called a riffle shuffle ) is one in which a deck of cards is split evenly, then merged into a new deck by alternately inserting cards from each half into the new deck. For instance, if our deck  contains 7 cards, labeled 0-6, we would perform the following steps.
Deck:  0 1 2 3 4 5 6
Split: 0 1 2 | 3 4 5 6
Prepare to Merge: 3 4 5 6
0 1 2
Merge:  3 0 4 1 5 2 6
Performing the same perfect shuffle operation on the new list, we get: 1 3 5 0 2 4 6. Repeating the  shuffle once again gives the original order: 0 1 2 3 4 5 6. We say that the order of this re-arrangement  (or permutation) is 3, since applying it to any deck 3 times returns the deck to its original order.
We will represent a deck of
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/花生_TL007/article/detail/294161
推荐阅读
相关标签