Subject: Re: Hanoi Tower
Date: Sat, 5 Apr 1997 11:58:34 -0500
From: Alexander Bogomolny

Hi, Amir:

I am not quite certain what is it you need. I believe the Description on my page is pseudo enough :) Real Java code follows closely this Description:

// real Java code starts

    public void Solve()
    {
        Solution(m_N, m_Src, m_Aux, m_Dst);
    }

    private void Solution(int n, int nSrc, int nAux, int nDst)
    {
        if (n == 0)
            return;

        Solution(n-1, nSrc, nDst, nAux);
        m_Moves.push(new Point(nSrc, nDst)); // use Point(from, to)
        Solution(n-1, nAux, nSrc, nDst);
    }

// real Java code ends

I have nothing below this level. Does it answer your question?

Reards

|Reply| |Up| |Exchange index| |Contents| |Store|

Copyright © 1996-2012 Alexander Bogomolny

 41169958

A math books store at a unique math study site. Shopping at the store helps maintain the site. Thank you.
Sites for teachers
Sites for parents
Terms of use
Awards
Interactive Activities

CTK Exchange
CTK Wiki Math
CTK Insights - a blog
Math Help
Games & Puzzles
What Is What
Arithmetic
Algebra
Geometry
Probability
Outline Mathematics
Make an Identity
Book Reviews
Stories for Young
Eye Opener
Analog Gadgets
Inventor's Paradox
Did you know?...
Proofs
Math as Language
Things Impossible
Visual Illusions
My Logo
Math Poll
Cut The Knot!
MSET99 Talk
Old and nice bookstore
Other Math sites
Front Page
Movie shortcuts
Personal info
Privacy Policy

Guest book
News sites

Recommend this site

Sites for parents

Education & Parenting

Search:
Keywords:

Google
Web CTK
Supported by
3wVentures