Update dynamic_programming/tree_height.cpp

Co-Authored-By: Christian Clauss <cclauss@me.com>
This commit is contained in:
Mann Mehta
2020-04-18 08:17:56 +05:30
committed by GitHub
parent 5a2238d8ef
commit f4c936d8be

View File

@@ -29,7 +29,7 @@ void dp_with_dfs(int u) {
if (!visited[v]) {
dp_with_dfs(v);
// selected maximum subtree height from all child.
// select maximum sub-tree height from all children.
child_height = std::max(child_height, dp[v]+1);
}
}
@@ -57,4 +57,3 @@ int main() {
dp_with_dfs(1);
std::cout << "Height of the Tree : " << dp[1] << std::endl;
}