add javadoc to buildTreeFromPairs
add demo for buildtreefrompairs