Saturday, January 13, 2018

Get minimum path sum of Root to leaf path in a tree

January 13, 2018

Introduction


It is my turn to write a tree recursive solution called minimum value of all path sum, for each path root to leaf node in a tree. I have already practiced multiple times, this time I spent first 15 minutes to write down my analysis.

Analysis of algorithm



It is the first time I have time to carefully go over each step and write down the analysis. This only happens after I master the recursive function using the template.

First of all I write down all the paths from root to leaf node first, and add the sum for each path. And I give a title called "Go over all the paths". Next I write down "Find minimum value". Third I write down my depth first search using recursive method. I write my template for recursive solution.

Here is my analysis of the algorithm:



Code review


Here is my C# code.



No comments:

Post a Comment