看板 Grad-ProbAsk 關於我們 聯絡資訊
※ 引述《gn00618777 (123)》之銘言: : 題目給你一些定義 : 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 == NULL) c=0; return c = 1 + count(root->left) + count(root->right); } 這樣就可以了 -- 學長學長!那邊有飆車族 學長學長!那邊剛好像有女生 學長學長!那邊有人紅燈右轉 砍人 被壓上車 ψQSWEET 鴿 鴿 鴿 鴿 鴿他媽的 鴿 ◎ ◎ 喔~~ ︶ ︶ ◎ ◎ 喔~~ ︶ ︶ ◎ ◎ 攔下來呀! ⊙◥ 3╯ξ 沒王法了 (哈欠) (煙~) 是不是?!( ) -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.137.190.25
gn00618777:~"~遞迴好難 乾脆把它背下來好了 02/12 20:34
FRAXIS:c=0那行應該是return 0吧.. 02/12 23:19
abc73021:其實基本上就是計算一顆二元數的方法而已 02/18 22:12