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

  You assign each int with a particular id

You assign each int with a particular ID.Array (4, 5, 6, 5, 4, 6) ID (1, 2, 3, 4, 5, 6)

  Describe ambiguity in proposed algorithm

Describe the distinction between an ambiguity in a proposed algorithm and an ambiguity in the representation of an algorithm. Describe how the use of primitives helps remove ambiguities in an algorithm's representation.

  Identifying the use cases of the system

Identifying the use cases of the system based on the narrative above, and giving a brief description for each of the use cases.

  List of common data structures

Make a list of some of the common data structures provided by C#. You should have a minimum of 4 different data types.

  Computing available storage space

There are twenty gigabyte of space on a computer's hard disk. I transfer information via a telephone line (connection) at the rate of 14,400 bits per second.

  Write a program that reads a file and builds a linked list

Write a program that reads a file and builds a linked list. After the list is built display it on monitor. You may use any appropriate data structure, but it should have a key field and data. Two possibilities are a list of your favourite CD's or ..

  Greedy strategy for finding a shortest path

Think about the given greedy strategy for finding a shortest path from vertex start to vertex goal in a connected graph.

  Ambiguity in proposed algorithm-in representation algorithm

Describe distinction between the ambiguity in proposed algorithm and ambiguity in representation of the algorithm.

  Explain feasibility analysis for jobs of lrt algorithm

Study feasibility analysis for jobs of LRT algorithm when preemption is allowed. Which scheduling algorithm is best suited for high speed networks and why? Distinguish between static and dynamic systems.

  What-if and goal-seeking analysis

Problem 1: What-if and Goal-seeking analysis, Problem 2: Portfolio Planning using optimization, Problem 3: A Monte Carlo Simulation Problem

  Create long queue-customers dequeue to next counter

Write a program to simulate a grocery store checkout counter. Construct one long queue from which customers dequeue to the next available counter.

  Creating visual studio.net web application

Make a Visual Studio.NET 2005 web application with one aspx form. Place a CheckBoxList, TextBox, Button, and Label control on the form.

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