Traverse binary tree by layer without the help of queue