We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Since a tree is a graph, it can be represented as a set of nodes and edges, of which we are given the edges in the form of pairs of nodes. A tree does not have to be represented as a parent-child relationship, as that is completely dependent on which node it's rooted in, which is not given in the problem statement or input data.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Cut the Tree
You are viewing a single comment's thread. Return to all comments →
Since a tree is a graph, it can be represented as a set of nodes and edges, of which we are given the edges in the form of pairs of nodes. A tree does not have to be represented as a parent-child relationship, as that is completely dependent on which node it's rooted in, which is not given in the problem statement or input data.