Number of edges in a perfect binary tree with N levels | Function to return the count of edges in an n - level perfect binary tree ; Driver code
function cntEdges ( n ) { var edges = Math . pow ( 2 , n ) - 2 ; return edges ; } var n = 4 ; document . write ( cntEdges ( n ) ) ;