zno2

递归

递:传递

归:回归(return

import org.junit.Test;

public class Digui {

    @Test
    public void diguiTest() {
        System.out.println(f(2));
    }

    public int f(int n) {
        //
        if (n == 1)
            return 1;
        //
        return n * f(n - 1);
    }

}

 

一个想法:想把递归做图形化展示,借助easyui 的tree

实现后的效果:

 

 

发现快速排序有栈内存溢出的风险 

 

具体项目见:svn  easyuidemotest

posted on 2016-08-05 18:43  zno2  阅读(63)  评论(0编辑  收藏  举报

导航