Question

Tower of Hanoi Problem with 5 pegs instead of 3. I want exactly 31 calls in the program. If finished by December 20th 2019 at 11:59O=pm Central US standard time I will rate a thumbs up. Coded in C.

// do comment if any problem arises

// code

#include <stdio.h>

// this function returns number of recursive calls for moving given number of pegs

int Hanoi(int n, char from, char to, char Using)

{

// move 1 disc

if (n == 1)

return 1;

// move 1 disc and then move n-1 discs from current peg to to peg using Using peg

return 1 + Hanoi(n - 1, from, Using, to) + Hanoi(n - 1, Using, to, from);

}

int main()

{

// move 5 discs from 1 to 3 using 2

int n = Hanoi(5, '1', '3', '2');

printf("Number of moves: %d\n", n);

}

Output:

#### Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
• ### (18 %) Problem 3: west of north Suppose you walk 11 m in a direction exactly...

(18 %) Problem 3: west of north Suppose you walk 11 m in a direction exactly 25° south of west then you walk 18 m in a direction exactly 44° 25% Part (a) How far are you from your starting point in m? R- 19.26 X Attempts Remain × 25% Part (b) What is the angle of the compass direction of a line connecting your starting point to your final position measured North of West in degrees? Grade Summary Deductions...

• ### please someone help me out answer this question i want 3 paragrah for this question and...

please someone help me out answer this question i want 3 paragrah for this question and in one paragraph i want 5 sentence so in total i want 15 sectence and also you can used internet too but dont copy from internet please help me out thank you Using drones to drop off packages could be great for buyers, who might want to get certain items as fast as humanly possible. Back in 2013, when Amazon revealed plans to begin...

• ### i need help with a mips program to to covert roman numerals to real numbers Lab 4: Roman Numeral Conversion Part A: Due...

i need help with a mips program to to covert roman numerals to real numbers Lab 4: Roman Numeral Conversion Part A: Due Sunday, 19 May 2019, 11:59 PM Due Friday, 24 May 2019, 11:59 PM Part B: Minimum Submission Requirements Ensure that your Lab4 folder contains the following files (note the capitalization convention): o Diagram.pdf o Lab4. asm O README.txt Commit and push your repository Lab Objective In this lab, you will develop a more detailed understanding of how...

• ### really need help i have been working on this for hours and barely made any progress,...

really need help i have been working on this for hours and barely made any progress, please complete second portion of hw problem from requirments 2-7 Requirements 1. Prepare Trenton's operating budget and cash budget for 2019 by quarter. Required schedules and budgets include: sales budget, production budget direct materials budget, direct labor budget, manufacturing overhead budget, cost of goods sold budget, selling and administrative expense budget, schedule of cash receipts, schedule of cash payments, and cash budget. Manufacturing overhead...

• ### You do NOT have to submit your personal questionnaire. But I do want you to answer...

You do NOT have to submit your personal questionnaire. But I do want you to answer this; Does taking this questionnaire change your thinking in any way regarding the behaviors of the children in your classroom? This Questionnaire will be asking you some questions about events that happened during your childhood; specifically the first 18 years of your life. The information you provide by answering these questions will allow us to better understand problems that may have occurred early in...

• ### C Program Please! Thanks! Spring 2019 ECE 103 Engineering Programming Problem Statement A standard deck of playi...

C Program Please! Thanks! Spring 2019 ECE 103 Engineering Programming Problem Statement A standard deck of playing cards contains 52 cards. There are four suits (heart, diamond club +, spade+) and thirteen ranks (ace, 2 thru 10,jack, queen, king) per suit. Rank Numeric Value 10 10 10 10 gueen 10 Write a program that does the following: I. Simulates a randomized shuffling of a 52 card deck 2. Determines how many combinations of 21 exist in the deck by following...

• ### In Problem Set 7 you designed and implemented a Message class. This time, let's design and...

In Problem Set 7 you designed and implemented a Message class. This time, let's design and implement a Mailbox class in a file named Mailbox java. Do the following with this class • You may use the Message class from PS 7. You will have to add new features to the Message class from PS 7 as you work through this problem. You are welcome to start with my sample solution if you wish • Suppose there are multiple mail...

• ### I need help with this assignment in C++, please! *** The instructions and programming style detai...

I need help with this assignment in C++, please! *** The instructions and programming style details are crucial for this assignment! Goal: Your assignment is to write a C+ program to read in a list of phone call records from a file, and output them in a more user-friendly format to the standard output (cout). In so doing, you will practice using the ifstream class, I'O manipulators, and the string class. File format: Here is an example of a file...

• ### Pleased read carefully I need solutions of questions 3 and 4. 1. 1151 The graphic below...

Pleased read carefully I need solutions of questions 3 and 4. 1. 1151 The graphic below shows actual inflation (this is labeled "headline inflation" in the chart) and inflation targets for a number of countries in 2014 Australia Using only information in the chart and frameworks developed in this class (i.e., not subsequent events), please answer the following questions: a. [5 points] At the time of the chart, which monetary policy would you have recommended for Sweden? Please explain in...

• ### I need answers of question 3 and 4. 1. 151 The graphic below shows actual inflation...

I need answers of question 3 and 4. 1. 151 The graphic below shows actual inflation (this is labeled headline inflation" in the chart) and inflation targets for a number of countries in 2014 September 2014 or ltest Seeden South Korea Japan India Using only information in the chart and frameworks developed in this class (i.e., not subsequent events), please answer the following questions a. [5 points] At the time of the chart, which monetary policy would you have recommended...