BINARY-TREE-ZIGZAG solved with help of stack and deque