update flatten binary tree