Consider an unbalanced tree (not necessarily a Binary Tree) of n nodes. You have to update weight of the n1th edge to n2 and print the maximum edge weight on the path from node n1 to node n2.
To achieve the above, you create a tree using an adjacency matrix representation of the tree (tree).
Assume that you have found the sub-tree size, depth and the parent of each node using an appropriate graph algorithm and you could successfully decompose the tree into disjoint chains. What should be your next step towards achieving the above task?