Populating Next Right Pointers in Each Node
2015-06-12 16:34
525 查看
class Solution {
public:
void connect(TreeLinkNode *root) {
if(!root) return;
if(root->left&&root->right) root->left->next=root->right;
if(root->next&&root->left) root->right->next=root->next->left; //判断root->right是否为空;
connect(root->left);
connect(root->right);
}
};
public:
void connect(TreeLinkNode *root) {
if(!root) return;
if(root->left&&root->right) root->left->next=root->right;
if(root->next&&root->left) root->right->next=root->next->left; //判断root->right是否为空;
connect(root->left);
connect(root->right);
}
};
相关文章推荐
- net_kernel:monitor_nodes 订阅node连接\断开消息
- 详细讲解nodejs中使用socket的私聊的方式
- 【node.js】基础<一>
- nodejs之connect模块
- Node开发这块目前比较理想的装配建议
- 使用node.js express 4.x 模块 搭建angular.js开发环境
- #leetcode#Populating Next Right Pointers in Each Node
- node-webkit实践-一键安装
- Windows下nodejs的安装与简单事例
- 编译contrail-nodemgr
- nodejs 文件与文件操作(读写文件 删除 重命名)
- 收集了NodeJS开发中常用的一些模块。
- Nodejs异步回调的优雅处理方法
- 通过Anuglar Material串串学客户端开发 - NodeJS模块机制之Module.Exports
- [6]_先从前端说起 - Nodejs学习之基础(1)
- 模拟namenode崩溃,使用secondarynamenode恢复
- leetcode 019 Remove Nth Node From End of List (Python)
- HDFS-datanode数据块部分笔记
- remove-nth-node-from-end-of-list
- NodeJS简单的网页跳转路由demo