Describe an algorithm to play the game of nim

Assignment Help Data Structure & Algorithms
Reference no: EM1379681

Describe an algorithm to play the Game of Nim using all of the three tools discussed in class (pseudocode, flowchart, hierarchy chart). The rules for the game are as follows:

- Two players take turns removing sticks from a pile of sticks.

- At the start of the game, there are 21 sticks on the pile.

- At each turn, a player can remove one, two, or three sticks from the pile.

- The game is over when the last stick is removed from the pile.

- The player who removes the last stick loses the game.

Include all necessary input, output, repetitions, sequences and decisions in your charts as appropriate.

The solution includes Rules of game and Pseudocode

 

Reference no: EM1379681

Questions Cloud

Prepare analyses to help in making their decisions : Using the data provided by the controller, prepare analyses to help Robert and Jane in making their decisions. (Hint: Prepare cost calculations for both product lines using ABC to see whether there is any significant difference in their unit costs). ..
Question about atm networks : ATM networks use a token bucket program to regulate traffic. A new token is put into the bucket every one usec so ATM cells can be sent during this period.
Question about processing packets : A CPU in a router can procedure two million packets/sec. The load offered to it is 1.5 million packets per sec. If the route from source to destination contains ten routers
Network crashes are hypothesized : Assume we are using Lamport's hash, and Bob's system crashes before receiving Alice's reply to a message.
Describe an algorithm to play the game of nim : Describe an algorithm to play the Game of Nim using all of the three tools discussed in class (pseudocode, flowchart, hierarchy chart).
Differences between the internet, intranets, extranets : Discuss similarities and differences between the Internet, intranets, extranets. Define e-Commerce and discussow can e-Commerce businesses be categorized?
Dealing with internet security and privacy : A procedure is said to be I/O bound if it needs a lot of I/O operations, whereas a procedure that consists of mostly computations within the CPU/memory system is said to be compute bound.
Supporting multiple incoming requests via threads : The email database server is created to accept multiple incoming requests via a socket in order to locate a specific message and return it to the customer email browser
How the specific volume of each liquid varies with temp : Using the information in the above table to show how the specific volume of each liquid varies with temperature.   You should plot a graph for each liquid and use this graph to estimate the exact value of a at 50°C for each liquid.

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Encryption feistel cipher and decryption algorithm

If this is psudocode for encryption feistel cipher determine decryption algorithm?Output: ciphertext = (left[16], right[16]) Explain pseudo-code of corresponding decryption algorithm for this cipher.

  Illustrate how b-tree will expand

Illustrate how tree will expand (after inserting each Part#), and what the final tree would like. (b) Repeat item (a), but use a B-tree of order p = 4 instead of a B+-tree.

  Calculate worst-case run-time complexity of algorithm

Calculate the worst-case run-time complexity of your algorithm and prove optimality of the solution it gives. Suppose that the road is a straight line with a western end and an eastern end.

  Implement iterative version of algorithm heapify

Using any programming language to implement iterative version of algorithm HEAPIFY. Show your algorithm by running it on the array that contain your name characters.

  Threat model to describe risk of attack vector

Construct a simple threat model that describes the risk this represents: attacker(s), attack vector, vulnerability, assets, and likelihood of occurrence, likely impact, and plausible mitigations.

  Write efficient pseudocode algorithm to determine record

Write the most efficient pseudocode algorithm you can to determine the record with specific customerID if every single customer ID from 101 to 500 is used and array has 400 elements.

  Compare the average behavior of insertion sort

Compare the average behavior of insertion sort for n elements with that of the n insertions into an initially-empty straight array implementation of a priority queue

  Explain how to modify knuth-morris-pratt algorithm

Explain how to modify Knuth-Morris-Pratt algorithm to support patterns with these wild cards, and analyze modified algorithm. Your algorithm must find first substring in text which matches the pattern.

  Data structures for a single algorithm

Data structures for a single algorithm

  Algorithm to concatenate string in single binary search tree

Create algorithm which concatenates T1 and T2 into single binary search tree. Worst case running time must be O(h).

  Design of sample and hold amplifiers for 100 msps by using n

The report is divided into four main parts. The introduction about sample, hold amplifier and design, bootstrap switch design followed by simulation results.

  Designing an algorithm for task-array of person numbers

You have been allotted task of designing an algorithm for following task. Someone has built the array of person numbers of all n students enrolled in 331 this fall.

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