towers-of-hanoi Questions

4

My professor gave this as an example of Prolog. It is a program that solves the Tower of Hanoi puzzle, where you have to move a stack of disks to another peg by moving one disk after the other, wit...
Coy asked 28/5, 2016 at 13:17

29

Solved

Although I have no problem whatsoever understanding recursion, I can't seem to wrap my head around the recursive solution to the Tower of Hanoi problem. Here is the code from Wikipedia: procedure ...
Herrod asked 3/8, 2009 at 16:33

5

Solved

Is there a solution for Towers of Hanoi whose running time is less than O(2n) where n is the number of disks to move? My solution takes O(2n) time. Also, the below solution is with recursion. Can ...
Recent asked 21/5, 2012 at 2:18

5

Solved

As you know there are some ways to solve Tower of Hanoi, but they require all disks to be in one tower at the begining. Now I wanna know is there any way to solve it, where the disks are already s...
Glacier asked 18/1, 2012 at 13:30

1

Solved

I have tested recursive method execution speed with classic example of Honoi Tower. First in Java than JRuby and Ruby with different no. of plates: package com.example; public class Hanoi { pu...
Kenyon asked 27/12, 2014 at 20:22

3

Solved

I am trying to solve the Towers of Hanoi at compile-time, but I have discovered a problem: template<int src, int dst> struct move_disc { // member access will print src and dst }; template...
Varion asked 8/11, 2013 at 17:19

1

when implementing the code for the "Towers of Hanoi" problem I get the following error message: hanoi.hs:4:24: parse error on input `=' Failed, modules loaded: none. Here is the code: h...
Azedarach asked 19/7, 2014 at 16:33

5

I'm completely new to Python and I am currently going over a tutorial about The Towers of Hanoi and recursion. I thought that I understood recursion until they gave this example: def moveTow...
Atrip asked 16/4, 2014 at 11:5

2

Solved

This is not homework, I don't have money for school so I am teaching myself whilst working shifts at a tollbooth on the highway (long nights with few customers). I am trying to implement a simple ...
Astrology asked 20/8, 2012 at 17:18

7

I believe that I have solved an open problem in complexity theory but I want to make sure that it's right. I problem in question is: ``How many moves does it take to solve the Towers of Hanoi puzz...
Carp asked 14/11, 2013 at 6:8

6

Solved

Here is a question from Facebook hiring sample test. There are K pegs. Each peg can hold discs in decreasing order of radius when looked from bottom to top of the peg. There are N discs which have...
Ammons asked 17/5, 2013 at 4:58

2

Solved

This is code from a book I have explaining recursion. The problem is that I don't understand the steps taken by the program: var hanoi = function(disc,src,aux,dst) { if (disc > 0) { hanoi(dis...
Maternity asked 4/8, 2011 at 19:46

2

Solved

It hurts to ask it here. It really does. Every time I search in vain for the answers to my troubles, I see it. Taunting me. Stack Overflow. Anyway, some hellish influence caused me to attempt to s...
Aerograph asked 25/7, 2011 at 14:23

3

Solved

I was lost on the internet when I discovered this unusual, iterative solution to the towers of Hanoi: for (int x = 1; x < (1 << nDisks); x++) { FromPole = (x & x-1) % 3; ToPole = ((...

4

Solved

Rules The Towers of Hanoi is a puzzle, and if you are not very familiar with it, here is how it works: The play field consists of 3 rods, and x number of disks, each next one bigger than th...
Pyelography asked 3/12, 2010 at 16:37

2

Solved

At the moment I'm reading Douglas Crockford's book, and the towers of hanoi function is a bit over my head. Even with logging stuff to the console I wasn't able to really understand what's go...
Myiasis asked 18/9, 2010 at 15:46

2

Solved

Possible Duplicate: How does this work? Weird Towers of Hanoi Solution While surfing Google, i found this interesting solution to Tower Of Hanoi which doesn't even use stack as data s...
Wag asked 20/5, 2010 at 2:37

1

I like the algorithm mentioned in this question: "How does this work? Weird Towers of Hanoi Solution" How does this work? Weird Towers of Hanoi Solution Is there any way to scale that non-recursiv...
Gregarious asked 27/3, 2010 at 20:40
1

© 2022 - 2024 — McMap. All rights reserved.