二叉树的下一个结点
时间限制:1秒
空间限制:32768K
热度指数:123053
算法知识视频讲解
校招时部分企业笔试将禁止编程题跳出页面,为提前适应,练习时请使用在线自测,而非本地IDE。
题目描述
给定一个二叉树和其中的一个结点,请找出中序遍历顺序的下一个结点并且返回。注意,树中的结点不仅包含左右子结点,同时包含指向父结点的指针。
笔记
收藏
纠错
二叉树的下一个结点
返回全部题目
剑指Offer_编程题
列表加载中...
上一题
下一题
讨论
排行
保存并调试
求助
做题遇到困难?
查看通过的代码
参与大家的讨论
查看编程常见问题
练习模式
切换考试模式,提前熟悉考试环境
练习模式
考试模式
保存并调试之后,这里将会显示运行结果
/* public class TreeLinkNode { int val; TreeLinkNode left = null; TreeLinkNode right = null; TreeLinkNode next = null; TreeLinkNode(int val) { this.val = val; } } */ public class Solution { public TreeLinkNode GetNext(TreeLinkNode pNode) { } }
/* struct TreeLinkNode { int val; struct TreeLinkNode *left; struct TreeLinkNode *right; struct TreeLinkNode *next; TreeLinkNode(int x) :val(x), left(NULL), right(NULL), next(NULL) { } }; */ class Solution { public: TreeLinkNode* GetNext(TreeLinkNode* pNode) { } };
# -*- coding:utf-8 -*- # class TreeLinkNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None # self.next = None class Solution: def GetNext(self, pNode): # write code here
/* public class TreeLinkNode { public int val; public TreeLinkNode left; public TreeLinkNode right; public TreeLinkNode next; public TreeLinkNode (int x) { val = x; } }*/ class Solution { public TreeLinkNode GetNext(TreeLinkNode pNode) { // write code here } }
/*function TreeLinkNode(x){ this.val = x; this.left = null; this.right = null; this.next = null; }*/ function GetNext(pNode) { // write code here } module.exports = { GetNext : GetNext };
val = $x; } }*/ function GetNext($pNode) { // write code here }
/*function TreeLinkNode(x){ this.val = x; this.left = null; this.right = null; this.next = null; }*/ function GetNext(pNode) { // write code here }