原文:[LeetCode] Populating Next Right Pointers in Each Node II 每个节点的右向指针之二

Given a binary tree Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should be set toNULL. Initially, all next pointers are set toNULL. Exa ...

2015-02-13 13:51 12 14103 推荐指数:

查看详情

leetcode-每个节点指针(填充同一层的兄弟节点

给定一个二叉树 填充它的每个 next 指针,让这个指针指向其下一个右侧节点。如果找不到下一个右侧节点,则将 next 指针设置为 NULL。 初始状态下,所有 next 指针都被设置为 NULL。 说明: 你只能使用额外常数空间。 使用递归解题也符合要求,本题中递归程序占用 ...

Mon Aug 27 03:10:00 CST 2018 0 782
 
粤ICP备18138465号  © 2018-2026 CODEPRJ.COM