I need to write an efficient algorithm to do the following task:
Given a list of nodes which can represent either a file or folder, construct the tree structure of the folder hierarchy. The node contains: 1. The parent path of the current node in String. 2. Whether this node is a file or folder.
I have spent one day to think about this but could not work out the answer. Is this something do-able?
Many thanks.