I am not able to understand the proof given in Heavy-light decomposition - PEGWiki
My understanding is when the tree is heavily unbalanced the number of chains that can be formed is in the order of n/2.
Please correct me if I am wrong.
I am not able to understand the proof given in Heavy-light decomposition - PEGWiki
My understanding is when the tree is heavily unbalanced the number of chains that can be formed is in the order of n/2.
Please correct me if I am wrong.
for heavily unbalanced i guess it will be lesser numbers of chains.
take example fully right skewed tree.
parent -> child
start -> 1 (root node)
1 -> 2
2 -> 3
3 -> 4
4 -> 5
Now when you make chains in this tree, you are going to have only one segment. that is 1 to 5.
similarly take example of balanced tree
start - > 1
1 -> 2
1 -> 3
2 -> 4
2 -> 5
3 -> 6
3 -> 7
in this graph your chains are going to look like :
You can see number of chains now are 4.
@anon41069019 let’s take this example below,
1->2
1->3
3->4
3->5
5->6
5->7
7->8
7->9
.
.
and so on,
according to my understanding the odd nodes form a single long chain and all the even nodes form n/2 chains of length 1. total (n/2 + 1) chains.
Am I correct ?