作者gn00618777 (123)
看板Grad-ProbAsk
标题[理工] [资结]-98政大资科
时间Fri Feb 12 17:44:23 2010
题目给你一些定义
typedef int DATA
struct node{
DATA element;
struct node *left;
struct node *right;
int height;
};
typedef struct node AVLNODE;
typedef AVLNODE *AVLTree;
题目要求利用int count(AVLtree noot) function来计算
AVL tree的noode数
我的想法是用中序式,来计算个数
int count(AVLTree root){
int c=0;
if(root->left!=NULL)
count(root->left);
c=c+1;
if(root->right!=NULL)
count(root->right);
return c;
}
感觉我的c好像会被盖掉,对递回概念不是很熟~"~
如果有错请问要怎麽修改?
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 220.138.110.105
1F:推 joe760414:你的count没有东西去接他??那他return的C..没人接收 02/12 18:01
2F:→ gn00618777:喔喔 02/12 19:17
3F:→ gn00618777:我的c是要给外面的人接收阿= = 02/12 19:39