add: flatten binary tree