If a tree is burnt from leaf how much time will it take to burn the tree completely
Answers
Answered by
8
"A binary tree is started burning from a leaf node. What is the time(1second to burn from node to node) it takes to entire tree get burned? The fire will spread to all the paths from a node."
Anonymous:
i will can inbox
Answered by
0
Answer:
log(n)
Explanation:
The max time to take to reach root node is log(n) i.e how far the node from the root node. Once fire reaches root node, It take another extra log(n) time to burn other side of tree i.e right or left sub tree of root node. If any node left of in first subtree after reach in root node, those will get burn in extra log(n) of time.
So time will be log(n) + log(n) ~ log(n)
Similar questions