@@ -0,0 +1,1057 @@
+/**%0A * Problem Link: https://leetcode.com/problems/populating-next-right-pointers-in-each-node/%0A * Binary Tree Level Traverse.%0A * Definition for binary tree with next pointer.%0A * public class TreeLinkNode %7B%0A *     int val;%0A *     TreeLinkNode left, right, next;%0A *     TreeLinkNode(int x) %7B val = x; %7D%0A * %7D%0A */%0Apublic class Solution %7B%0A    public void connect(TreeLinkNode root) %7B%0A        if(root == null) return;%0A        Queue%3CTreeLinkNode%3E q = new LinkedList%3CTreeLinkNode%3E();%0A        q.offer(root);%0A        int cur = 1;%0A        int nxt = 0;%0A        while(!q.isEmpty()) %7B%0A            TreeLinkNode node = q.poll();%0A            cur--;%0A            if(node.left != null) %7B%0A                q.offer(node.left);%0A                nxt++;%0A            %7D%0A            if(node.right != null) %7B%0A                q.offer(node.right);%0A                nxt++;%0A            %7D%0A            if(cur == 0) %7B%0A                node.next = null;%0A                cur = nxt;%0A                nxt = 0;%0A            %7D else %7B%0A                node.next = q.peek();%0A            %7D%0A        %7D%0A    %7D%0A%7D%0A

Create Populating_Next_Right_Pointers_in_Each_Node.java