0

Sum of all nodes in Binary tree

Problem: Calculate sum of all nodes in a binary tree.

You refer following image to understand ¬†function calls in above recursive method.   We need to visit all nodes, so time complexity will be O( n)