For this Question: Given a Binary Tree containing <b>N</b> nodes. The task is to print the nodes of binary tree in ZigZag manner. Below diagram shows nodes of binary tree printed in ZigZag manner.

<b>ZigZag:</b> While traversing binary tree level wise you have print the nodes from left to right and then right to left alternatively i.e. first level from left to right, next level right to left, then again left to right and so on.<b>User Task:</b>
Since this will be a functional problem, you don't have to take input. You just have to complete the function <b>zigZagTraversa()</b> that takes "root" node as parameter and The printing is done by the driver code.

<b>Constraints:</b>
1 <= T <= 50
1 <= N <= 10^4

<b>Sum of N over all testcases does not exceed 10^5</b>

 For each test case you need to return the ArrayList containing node values of binary tree in ZigZag manner. The driver code will take care of printing them up.Input:
2
3 2 1
7 7 9 8 8 6 N 10 9

Output:
3 1 2
7 9 7 8 8 6 9 10

Explanation:
Testcase 1: Given tree is
                         3
                      /       \
                    2        1
Hence the zigzag traversal will be 3 1 2.
Testcase 2: Given tree is 
                           7
                       /        \
                      7           9
                /        \      /     \
               8        8    6      N
            /   \ 
          10    9 
Hence the zigzag traversal will be 7 9 7 8 8 6 9 10., I have written this Solution Code: static ArrayList<Integer> list = new ArrayList<>();
    static ArrayList<Integer> zigZagTraversal(Node root)
    {
        list = new ArrayList<>();
        if(root==null)
            return list;
        Stack<Node>s1=new Stack<Node>();
        Stack<Node>s2=new Stack<Node>();
        s1.push(root);
        while(s1.empty()==false || s2.empty()==false)
        {
            while(s1.empty()==false)
            {
                Node p=s1.pop();
               list.add(p.data);
                if(p.left!=null)
                    s2.push(p.left);
                if(p.right!=null)
                    s2.push(p.right);
            }
            while(s2.empty()==false)
            {
                Node p=s2.pop();
                list.add(p.data);
                if(p.right!=null)
                    s1.push(p.right);
                if(p.left!=null)
                    s1.push(p.left);
            }
        }
        return list;

    }, In this Programming Language: Java, Now tell me if this Code is compilable or not?