Determine the count of Leaf nodes in an N | Function to calculate leaf nodes in n - ary tree ; Driver code
< ? php function calcNodes ( $ N , $ I ) { $ result = 0 ; $ result = $ I * ( $ N - 1 ) + 1 ; return $ result ; } $ N = 5 ; $ I = 2 ; echo " Leaf ▁ nodes ▁ = ▁ " . calcNodes ( $ N , $ I ) ; ? >