读书人

leetcode:Populating Next Right Poi

发布时间: 2013-10-18 20:53:13 作者: rapoo

leetcode: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:

读书人网 >其他相关

热点推荐