What is Heavy-Light Decomposition and when is it used in tree-based problems?
Heavy-Light Decomposition is a technique to divide a tree into heavy and light edges, but it is mostly useful for solving problems like sorting nodes.
Thatâ€™s incorrect. Heavy-Light Decomposition is used for efficiently handling path queries, not for sorting nodes.
Can you explain how path queries are optimized using Heavy-Light Decomposition?