You are viewing a single comment's thread. Return to all comments →
"one has to make the working assumption that the first node provided is the root"
I disagree. You just lucked out because all the test cases allowed you to make that assumption.
If you think it through, you'll see that any leaf node will do for a root, and the first node provided does not have to be a leaf.
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 →
"one has to make the working assumption that the first node provided is the root"
I disagree. You just lucked out because all the test cases allowed you to make that assumption.
If you think it through, you'll see that any leaf node will do for a root, and the first node provided does not have to be a leaf.