Create Populating Next Right Pointers in Each Node 

Given a binary tree

    struct TreeLinkNode {
      TreeLinkNode *left;
      TreeLinkNode *right;
      TreeLinkNode *next;
    }
Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should be set to NULL.

Initially, all next pointers are set to NULL.

Note:

You may only use constant extra space.
You may assume that it is a perfect binary tree (ie, all leaves are at the same level, and every parent has two children).
For example,
Given the following perfect binary tree,
         1
       /  \
      2    3
     / \  / \
    4  5  6  7
After calling your function, the tree should look like:
         1 -> NULL
       /  \
      2 -> 3 -> NULL
     / \  / \
    4->5->6->7 -> NULL

第一次一次写完编译Accepted..主要做两个队列，第一个是存储当前这一层的节点，第二个是存储下一层的节点，逐层遍历往复循环。但是遍历的过程是从右往左，而不是通常的从左往右，因为先出队列的几点将是下一个的next,第一个先出来的next就是null了，比较容易理解，其实从右往左也可以，但是比较难写。