Heavy-Light Decomposition

Can someone provide a good tutorial(well explained) or provide some link on how to exactly implement H-L Decomposition. I have searched a lot and been through almost all suggested websites. The main problem is in the segment tree part. I have seen some implementations but cant understand really why all that is being done.

A walk, through code would be really helpful in understand the essence.

Thank You

1 Like

These are good for getting a basic idea of HLD

http://wcipeg.com/wiki/Heavy-light_decomposition

2 Likes

I have gone through these links but still cant implement. The segment tree part to answer queries is actually the real problem.

This is a good tutorial on HLD by Anudeep.

Some basic problem to solve using HLD:
Problem1 , Problem2

1 Like

https://apps.topcoder.com/forums/?module=Thread&threadID=796128&start=0&mc=8

Codeforces:

http://codeforces.com/blog/entry/12239

Praveen dhinwa:

Code:

//