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