generate a tree using an int array , especially good for test cases in leetcode