Number of edges in a perfect binary tree with N levels | C ++ implementation of the approach ; Function to return the count of edges in an n - level perfect binary tree ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; int cntEdges ( int n ) { int edges = pow ( 2 , n ) - 2 ; return edges ; } int main ( ) { int n = 4 ; cout << cntEdges ( n ) ; return 0 ; }