How many rounds it will take to put a deck back

Assignment Help Computer Engineering
Reference no: EM132780793

Question: You are given a deck containing N cards. While holding the deck facedown:

1. Deal all the cards facedown onto a table into Y piles like you would if you were playing with a group of people (i.e. card 1 to P1, card 2 to P2, ..., card Y to PY, card Y + 1 to P1, etc).

2. Combine all the piles into a deck by placing P1 onto P2, then P1+P2 onto P3, and so on. This is a round.

3. Pick up the deck from the table and repeat steps 1-2 until the deck is in the original order.

4. For each round, vary the pile count according to a repeating pattern. Start with 3 piles, then 4, then 5, then loop back to 3, then 4 and so on.

Write a program to determine how many rounds it will take to put a deck back into the original order. This will involve creating a data structure to represent the order of the cards. Do not use an array. This program should be written in C only. It should take a number of cards in the deck as a command line argument and write the result to stdout. Please ensure the program compiles and runs correctly (no pseudo-code). This isn't a trick question; it should be fairly straightforward.

Output how many rounds should be completed before the deck is adequately shuffled from the original deck for a person who is casually playing a game with cards. Provide your methodology in a comment block.

Reference no: EM132780793

Questions Cloud

How should backup media be secured : Search "scholar.google" for a company or school that has reported issues, problems, concerns about their backup procedures. Discuss the issue of securing.
Why does the government chose to place an excise tax : Why does the government chose to place an excise tax (tax on manufacturing) on goods such as cigarettes, alcohol, and tobacco in Canada
Calculate amount that concord should report as a deferred : 25% for 2021 and 2022, and 30% for 2023. Calculate the amount that Concord should report as a deferred tax asset or liability at December 31, 2020.
What is the purpose of a balanced portfolio : What is the purpose of a balanced portfolio? How do various investments react when the stock market goes down? Goes up? Please give use examples in the answer.
How many rounds it will take to put a deck back : Write a program to determine how many rounds it will take to put a deck back into the original order. This will involve creating a data structure to represent.
Find output of private goods and services : As productive resources and technological know-how increase, a nation's production-possibility curve shifts outward. Use a production-possibility curve
Which type of control is not considered an itgc : Which of the following type of control is NOT considered an ITGC? Application system acquisition controls. / Program change controls
Compute the production costs for the period : An additional 3,000 units of materials were added in the department. Compute the production costs for the period
Cloud-based is better option than in-house hosting : Using specific examples, discuss when cloud-based is a better option than in-house hosting.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd