algorithm diagram

Posted by tunl on Stack Overflow See other posts from Stack Overflow or by tunl
Published on 2010-05-17T10:59:42Z Indexed on 2010/05/17 11:00 UTC
Read the original article Hit count: 452

Filed under:

This is the max searching algorithm diagram: alt text

So, I wonder how can draw diagram for Recursion in HaNoi Tower program:

package tunl; 

public class TowersApp {
    static int n = 3;

    public static void main(String[] args) {
        TowersApp.doTowers(3, 'A', 'B', 'C');
    }

    public static void doTowers(int n, char from, char inter, char to) {
        if (n == 1) {
            System.out.println("disk 1 from  "+ from + "  to  " + to);
        } else {
            doTowers(n-1, from, to, inter);
            System.out.println("disk  " + n + "  from  " + from + "  to  " + to);
            doTowers(n-1, inter, from, to);
        }
    }
}

I can't draw it. Anyone can help me !!!

© Stack Overflow or respective owner

Related posts about algorithm-design