d2jsp
Log InRegister
d2jsp Forums > Off-Topic > General Chat > Homework Help > Towers Of Hanoi Iterativly > In Java
Add Reply New Topic New Poll
Member
Posts: 2,315
Joined: Oct 22 2009
Gold: 43.50
Sep 11 2013 09:10am
Hey, I know...I know...I should be able to do this is third year computer science. But I can't and I feel like an idiot so help me!!

I need help starting a solution to solve a towers of hanoi problem using iteration. I got the recursion down pat but iteration is screwing me over here. I just can't wrap my head around it.

I know there is a different pattern based on if (sizeOfTower % 2 == 0) {} else {} and i know there is 2^n -1 moves that need to be done but I just cant seem to get this pattern down.

Any help JSP?
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Sep 11 2013 10:42am
if you know recursion, just replace the recursive call with a stack and loop.

https://www.google.com/search?q=Towers+Of+Hanoi+Iterativly+In+Java

This post was edited by carteblanche on Sep 11 2013 10:43am
Go Back To Homework Help Topic List
Add Reply New Topic New Poll