Tree flatten fix

tree flatten fix based on coursera.org Algorithms I. class. Slides: https://d396qusza40orc.cloudfront.net/algs4partI/slides%2F15UnionFind.pdf