看板 Grad-ProbAsk 關於我們 聯絡資訊
題目給你一些定義 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
joe760414:你的count沒有東西去接他??那他return的C..沒人接收 02/12 18:01
gn00618777:喔喔 02/12 19:17
gn00618777:我的c是要給外面的人接收阿= = 02/12 19:39