leetcode Populating Next Right Pointers in Each Node
2014-05-20 11:18
253 查看
/** 根据完美二叉树或者非完美二叉树都可以,利用左右子树的根节点的next节点信息来连接next */ public void connect(TreeLinkNode root){ if(root==null) return; //利用父节点的next链接节点 if(root.left!=null){ root.left.next=root.right; } if(root.right!=null&&root.next!=null){ root.right.next=root.next.left; } connect(root.left); connect(root.right); }
相关文章推荐
- [LeetCode] Populating Next Right Pointers in Each Node
- [Leetcode] Populating Next Right Pointers in Each Node
- [Leetcode] Populating Next Right Pointers in Each Node ii
- LeetCode: Populating Next Right Pointers in Each Node
- 【leetcode】Populating Next Right Pointers in Each Node II
- LeetCode Populating Next Right Pointers in Each Node
- LeetCode - Populating Next Right Pointers in Each Node
- Leetcode: Populating Next Right Pointers in Each Node
- leetcode 79: Populating Next Right Pointers in Each Node II
- LeetCode: Populating Next Right Pointers in Each Node
- [LeetCode] Populating Next Right Pointers in Each Node
- LeetCode(Oct28'12):Populating Next Right Pointers in Each Node II
- [LeetCode]Populating Next Right Pointers in Each Node
- leetcode 78: Populating Next Right Pointers in Each Node
- [LeetCode] Populating Next Right Pointers in Each Node II
- [LeetCode] Populating Next Right Pointers in Each Node II 解题报告
- 【leetcode】 Populating Next Right Pointers in Each Node
- leetcode Populating Next Right Pointers in Each Node II
- [Leetcode]Populating Next Right Pointers in Each Node II
- leetcode 79: Populating Next Right Pointers in Each Node II