algo_050.md (372B)
1 # algo_050 2 3 ### Problem Statement 4 5 > Write an algorithm to count the number of internal nodes in a binary tree. 6 7 ## Algorithm 8 ``` 9 procedure countInternal(T) 10 begin 11 if (T = NULL) then 12 return 0; 13 else if (LC(T) = NULL and RC(T) = NULL) then 14 return 0; 15 else 16 return 1 + countInternal(LC(T)) + countInternal(RC(T)); 17 endif 18 end procedure 19 ```