Hey guys!
I am trying to solve Qtree2 from SPOJ after learning about LCA using binary lifting.Problem
There are 2 parts to this question one is to find distance between any two given nodes and the other part is to find kth node in the path between 2 nodes.
While I was able to solve the first part, but I am stuck in solving second part, I tried a lot (only clue i was able to find out is that the path goes through LCA of two nodes) and couldn't proceed from there.
It would be really helpful if someone could give a detailed explanation using binary lifting it would be great. Thank you so much!