Towers of Hanoi

This is a discussion on Towers of Hanoi within the C++ Programming forums, part of the General Programming Boards category; In the Deitel and Deitel book I'm reading they say the following: "EVery budding computer scientist must grappel with certain ...

  1. #1
    Registered User cyberCLoWn's Avatar
    Join Date
    Dec 2003
    Location
    South Africa
    Posts
    124

    Towers of Hanoi

    In the Deitel and Deitel book I'm reading they say the following:

    "EVery budding computer scientist must grappel with certain classic problems. The Towers of Hanoi is one of the most famous of these."

    I'm just wondering if anyone has ever done this problem before..

  2. #2
    Cheesy Poofs! PJYelton's Avatar
    Join Date
    Sep 2002
    Location
    Boulder
    Posts
    1,728
    I'm guessing at least 75% of those who have programmed for more than a few months has done the Towers. Pretty simple with recursion.

  3. #3
    Senior Member joshdick's Avatar
    Join Date
    Nov 2002
    Location
    Phildelphia, PA
    Posts
    1,146
    I'm a freshman CS and math major. That problem was covered in depth in a math class I had last term called Techniques of Math Proof. Good stuff.
    FAQ

    "The computer programmer is a creator of universes for which he alone is responsible. Universes of virtually unlimited complexity can be created in the form of computer programs." -- Joseph Weizenbaum.

    "If you cannot grok the overall structure of a program while taking a shower, you are not ready to code it." -- Richard Pattis.

  4. #4
    Registered User cyberCLoWn's Avatar
    Join Date
    Dec 2003
    Location
    South Africa
    Posts
    124
    Dammit! Now I'll have to do it as well. Hehe

    Not that I have a clue how to go about it. Something better click inside my head. This would be my last exercise with functions before moving to arrays and then pointers. Exciting stuff!
    The joys of newbieness..

  5. #5
    Been here, done that.
    Join Date
    May 2003
    Posts
    1,161
    Originally posted by PJYelton
    I'm guessing at least 75% of those who have programmed for more than a few months has done the Towers. Pretty simple with recursion.
    Yeah, but try it in assembler. It's a real trip!
    Definition: Politics -- Latin, from
    poly meaning many and
    tics meaning blood sucking parasites
    -- Tom Smothers

  6. #6
    Registered User Moni's Avatar
    Join Date
    Oct 2002
    Location
    Dhaka, Bangladesh.
    Posts
    104
    Originally posted by WaltP
    Yeah, but try it in assembler. It's a real trip!
    Huh! correct!

    Not only that it's also very difficult to code without recursion
    We all are the components of a huge program...... the programmer is always debugging us with His debugger.

  7. #7
    Registered User glUser3f's Avatar
    Join Date
    Aug 2003
    Posts
    345
    check out this:
    http://www.kernelthread.com/hanoi/
    108 implementations of the Towers of Hanoi.
    There is also an implementation in C preprocessor, but I can't seem to remember where I found it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. towers of hanoi - what is wrong with this code?
    By kanesoban in forum C Programming
    Replies: 4
    Last Post: 09-17-2007, 02:20 PM
  2. Towers of Hanoi (need help)
    By Loudan in forum C++ Programming
    Replies: 3
    Last Post: 01-30-2006, 10:17 PM
  3. towers of hanoi problem
    By aik_21 in forum C Programming
    Replies: 1
    Last Post: 10-02-2004, 02:34 PM
  4. Towers of Hanoi, special output.
    By spoon_ in forum C Programming
    Replies: 3
    Last Post: 03-15-2003, 06:08 PM
  5. Towers of Hanoi
    By janehung in forum C Programming
    Replies: 12
    Last Post: 01-07-2002, 06:40 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21