More understanding on tree structure, implemented getWeight of nodes