Write a procedure to produce the alternative description

Assignment Help Data Structure & Algorithms
Reference no: EM13912767

The solution to the Towers of Hanoi problem given in the text assumes that the pegs are numbered, and the complete description is in those terms. Thus 1 3 is interpreted as move the (top) ring from peg 1 to (become the top ring of) peg 3. An alternative view is to assume that the n·ngs are numbered from the smallest to the largest starting at 1. We can then describe moves by indicating the ring to be moved and its direction. For convenience we will describe the directions as clockwise (C), and anticlockwise (A ), thinking of the towers as being in a triangular formation with the pegs numbered anticlockwise. Thus the following are two alternative descrip­ tions of moving a tower for n=3.

13 IC
12 2A
32 IC
13 3C
21 IC
23 2A
1 3 IC

Write a procedure to produce the alternative description of the moves based on the observations:

(i) If we can move a tower of k rings in either direction we can certainly move a tower of k +1rings by:

(a) moving the top k rings in the opposite direction ;

(b) moving ring k +1 in the correct direction ;

(c) moving the top k rings again in the opposite direction.

(ii) We can trivially move one ring.

Reference no: EM13912767

Questions Cloud

Designing a mobile computing application : As using the GPS is battery consuming, the app should also be sensitive to battery levels and perhaps stop GPS based tracking or disallow tracking or warn the user if battery levels are too low - When a tracked path is saved, LTUPersonalLogger shou..
Force needed to drive the conveyor : Sand drops at the rate of 2000 kg/min. from the bottom of a hopper onto a belt conveyor moving horizontally at 250 m/min. Determine the force needed to drive the conveyor, neglecting friction.
A standard cost approach : A fast-food restaurant uses a standard cost approach to aid in controlling its food cost. The following are the standard cost, sales prices, and quantities sold of each of the five items featured on the menu during a particular week:
Money in the economy changed : While Jon is walking to school one morning, a helicopter flying overhead drops a $100 bill. Not knowing how to return it, Jon keeps the money and deposits it in his bank.After this initial transaction, by how much is the money in the economy changed.
Write a procedure to produce the alternative description : Write a procedure to produce the alternative description of the moves based on the observations If we can move a tower of k rings in either direction we can certainly move a tower of k +1rings.
Calculate the acceleration of the system : The block m1=1 kg sliding on a flat frictionless surface is connected by a string over a pulley to the hanging block m2=10kg. The system is released from the rest. Calculate the acceleration of the system
Statement of cash flows : Which one of the following categories on a statement of cash flows is used to report the cash flow effects of buying and selling property, plant, and equipment
Kinetic energy as the cricket ball : A cricket bowler can bowl a 158 g ball at 147 km/hr. Calculate the kinetic energy of this bowl and use this to compare to a bowling ball that weighs 7 kg. How fast would the bowling ball need to be bowled to have the same kinetic energy as the cri..
Bank reconciliation : A restaurant carries out a monthly bank reconciliation. The August 31 reconciliation showed the following: The restaurant bank balance is $4,112 and the bank statement balance is $2,760. Prepare a bank reconciliation for August 2004.

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Implement an open hash table

In this programming assignment you will implement an open hash table and compare the performance of four hash functions using various prime table sizes.

  Use a search tree to find the solution

Explain how will use a search tree to find the solution.

  How to access virtualised applications through unicore

How to access virtualised applications through UNICORE

  Recursive tree algorithms

Write a recursive function to determine if a binary tree is a binary search tree.

  Determine the mean salary as well as the number of salaries

Determine the mean salary as well as the number of salaries.

  Currency conversion development

Currency Conversion Development

  Cloud computing assignment

WSDL service that receives a request for a stock market quote and returns the quote

  Design a gui and implement tic tac toe game in java

Design a GUI and implement Tic Tac Toe game in java

  Recursive implementation of euclids algorithm

Write a recursive implementation of Euclid's algorithm for finding the greatest common divisor (GCD) of two integers

  Data structures for a single algorithm

Data structures for a single algorithm

  Write the selection sort algorithm

Write the selection sort algorithm

  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.

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