Introduction
It is an easy level algorithm called Average of levels in binary tree. I like to write the code for the algorithm.
My practice
Here is C# algorithm I wrote. The idea is to use queue and then traverse the tree level by level. Each level the sum of all nodes are calculated and then average is also calculated.
No comments:
Post a Comment