线索Cues | 笔记Notes |
|
一、
def look_for_key(box): for item in box: if item.is_a_box(): look_for_key(item) elif item.is_a_key(): print"found the key" 二、
三、
def fact(x): if x==1: return 1 else: return x*fact(x-1) |
Codes | |
c++ #include<iostream> using namespace std; int recursive(int a) { if(a==1) return 1; else return a*recursive(a-1); } int main() { int a=5; cout<<recursive(a)<<endl; return 0; } |
《算法图解》chap3递归
猜你喜欢
转载自www.cnblogs.com/huangyilong/p/11449581.html
今日推荐
周排行