Questions tagged [towers-of-hanoi]
15 questions
20
votes
1 answer
Complexity of Towers of Hanoi
I ran into the following doubts on the complexity of Towers of Hanoi, on which I would like your comments.
Is it in NP?
Attempted answer: Suppose Peggy (prover) solves the problem & submits it to Victor (verifier). Victor can easily see that the…
PKG
- 1,489
- 10
- 15
11
votes
1 answer
Towers of Hanoi but with arbitrary initial and final configuration
Recently, I came across this problem, a variation of towers of hanoi.
Problem statement:
Consider the folowing variation of the well know problem Towers of
Hanoi:
We are given $n$ towers and m disks of sizes $1,2,3,\dots,m$ stacked on some
…
Null
- 211
- 1
- 3
7
votes
1 answer
An Alternative Hanoi Tower problem
We got tower $T_1$ with $n$ odd disks (1,3,5,...) and tower $T_2$ with $n$ even disks (2,4,6,...).
Now we want to move all $2n$ disks to tower $T_3$.
If $T(p,q)$ is a recurrence relation of minimum number of moves we make to move $p$ disks from…
Parisa
- 151
- 1
- 1
- 5
4
votes
1 answer
Induction to prove equivalence of a recursive and iterative algorithm for Towers of Hanoi
Using induction how do you prove that two algorithm implementations, one recursive and the other iterative, of the Towers of Hanoi perform identical move operations? The implementations are as follows.
Hanoi(n, src, dst, tmp):
if n > 0
…
gunnnnii
- 43
- 4
3
votes
1 answer
Analysis of the Banana Game
My computer science professor introduced an interesting game in order to get us (his students) more familiar with the Stack and Queue ADTs.
Game Description
The banana game is played with a container -- e.g., a queue or a stack. The object of the…
antonky
- 133
- 4
2
votes
0 answers
Proof for Iterative Solution of Towers of Hanoi
1. Calculate the total number of moves required i.e. "pow(2, n)- 1".
Here n is number of disks.
2. If number of disks (i.e. n) is even then interchange destination
pole and auxiliary pole.
3. for i = 1 to total number of…
user7952
- 21
- 2
2
votes
0 answers
Complexity class of Towers of Hanoi problem
Given a problem
List all steps to move n disks from rode 1 to rode 2.
I guess you are familiar with Towers of Hanoi rules.
I couldn't find a proper answer for the complexity class of this problem. My first guess would be NP or even NP-hard yet…
Y N
- 247
- 1
- 7
2
votes
1 answer
Computing a Sequence of People Entering and Leaving a Room
I've been working on a problem for my Algorithms class, but I've found myself stuck. The prompt is as follows.
You start with an empty room and a group of n people waiting outside. At each step, you may either admit one person into the room, or let…
jroschen
- 123
- 3
2
votes
1 answer
Tower of Hanoi variation - Split into two towers of odd and even disks
Suppose we have three rods A, B and C, and rod A contains n disks (Exactly like the original Tower of Hanoi problem). The disks are numbered 1 to n, when the bottom disk is number 1 and the top disk is number n.
I want to build two towers: One on…
Daniel
- 129
- 4
1
vote
4 answers
Towers of Hanoi First Move
I've finally more or less understood the recursive algorithm for solving the Towers of Hanoi. My Python code is below.
However one thing still bugs me - I can't yet work out how this simple seeming algorithm can "know" which move to make first -…
Robin Andrews
- 265
- 4
- 15
1
vote
0 answers
Hanoi Tower Variation: Place Maximum Number of Balls on $N$ Pegs
Problem Statement. There are many interesting variations on the Tower of Hanoi problem. This version consists of $N$ pegs and one ball containing each number from $1, 2, 3, \dots$ Whenever the sum of the numbers on two balls is not a perfect square…
neutron-byte
- 389
- 1
- 8
1
vote
2 answers
How do I approach inductive design problems with no information or context given?
As a starting point for our course in Artificial Intelligence, we are being taught induction. We received a number of homework assignments where we have to show our inductive approach for a given problem.
An example of such a problem: "Sort an array…
Zimano
- 113
- 6
1
vote
2 answers
Tower Of Hanoi Time Calculation
I have been trying this Towers of Hanoi question since last week but never able to come with the right approach towards the solution.
The setup is the standard Towers of Hanoi, except that moving the smallest disk costs one unit of time, moving the…
arqam
- 123
- 5
1
vote
1 answer
Towers of Hanoi with sufficiently many stacks, show that $T_k(n)=\Theta(n)$ for all $k\geq 2 + \frac{n-1}{2}$
I'm trying to show that for the following Towers of Hanoi general algorithm that $T_k(n)=\Theta(n)$ for all $k\geq 2 + \frac{n-1}{2}$, I'm not sure how to incorporate the restriction on $k$ into my proof.
generalTH(n_disks,k_stacks)
if n
Elliott de Launay
- 161
- 6
0
votes
0 answers
Does a bijective function exists behind every recurrence relation?
Consider these 2 questions where recurrence relations can be applied:
Q1) Given an (nxm) where n denotes rows and m denotes columns of a grid, find the number of unique paths ($a_{n,m}$) that goes from the top left corner of the grid to the bottom…
rustlecho
- 1
- 1