Normal
Jasablanca
这个作者很懒,什么都没留下…
展开
-
递归求π
题目描述: 算法思想: 以递归的方式求分母,在main函数中求π值 核心代码: #include <stdio.h> #include <algorithm> #include <math.h> double fun(double n) { if(n==0) return 1; if(n==1) retur...原创 2019-08-30 08:45:54 · 1518 阅读 · 3 评论 -
二叉树深度
int Tree_Depth(TNode* &T) { if(T==NULL) return 0; int hl=Tree_Depth(T->lchild); int hr=Tree_Depth(T->rchild); return hl>hr?hl+1:hr+1; } 这样写比较好理解,先递归左子树,再递归右子树,返回两...原创 2019-09-04 20:45:27 · 110 阅读 · 0 评论