Question: ********C Programming******** Write a recursive function that counts the number of moves that have to be made to transfer a stack of disks from one
********C Programming********
Write a recursive function that counts the number of moves that have to be made to transfer a stack of disks from one pole to another. The following program can be used to calculate the time needed by the priests to transfer the stack of 64 disks. They will move one disk at a time and this will take an average of one second per disk.
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Your program should give the answer in billions of years! 1 billion = 1000 million = 109. And 1 year = 60 * 60 * 24 * 365 seconds! Write your implementation of the count_moves function. The function returns the number of moves needed to transfer the stack of disks. Remember the three steps as explained during the lecture. Use recursion to solve the problem, so no loops or static variables in the recursive function! Also, do not use global variables in your program. The estimated age of the universe is approximately 13.8 billion years. The priests were given the stack of disks at the beginning of time. How many times the current age of the universe will it take for the priests to finish their work?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
