how does the last level has 2^n-1 nodes.
Time complexity of a recursive function
For a complete binary tree
The 1st level has 1 node (which is the root node)
2nd level has 2 node
3rd level – 4 nodes
4th level – 8 nodes ie. 2^3
So nth level – 2^(n-1) nodes
You can draw the tree and verify
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.