Function to calculate the number of trees in which the root has degree r .
function rootDegreeR ( $ n , $ r ) { $ ans = $ r * binomialCoeff ( 2 * $ n - 1 - $ r , $ n - 1 ) ; $ ans = $ ans / $ n ; echo " Number ▁ of ▁ trees ▁ having ▁ 4 ▁ edges " , " ▁ where ▁ root ▁ has ▁ degree ▁ 2 ▁ : ▁ " , $ ans ; return 0 ; }