剑指offer
二叉搜索树与双向链表
相似的企业真题
时间限制:C/C++ 1秒,其他语言2秒
空间限制:C/C++ 64M,其他语言128M
热度指数:505651
本题知识点:
分治
算法知识视频讲解
校招时部分企业笔试将禁止编程题跳出页面,为提前适应,练习时请使用在线自测,而非本地IDE。
题目描述
输入一棵二叉搜索树,将该二叉搜索树转换成一个排序的双向链表。要求不能创建任何新的结点,只能调整树中结点指针的指向。
说明:本题目包含复杂数据结构TreeNode,
点此查看相关信息
上一题
下一题
登录
/
注册
我的提交
编辑器加载中...
/** public class TreeNode { int val = 0; TreeNode left = null; TreeNode right = null; public TreeNode(int val) { this.val = val; } } */ public class Solution { public TreeNode Convert(TreeNode pRootOfTree) { } }
/* struct TreeNode { int val; struct TreeNode *left; struct TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL) { } };*/ class Solution { public: TreeNode* Convert(TreeNode* pRootOfTree) { } };
# -*- coding:utf-8 -*- # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def Convert(self, pRootOfTree): # write code here
/* public class TreeNode { public int val; public TreeNode left; public TreeNode right; public TreeNode (int x) { val = x; } }*/ class Solution { public TreeNode Convert(TreeNode pRootOfTree) { // write code here } }
/* function TreeNode(x) { this.val = x; this.left = null; this.right = null; } */ function Convert(pRootOfTree) { // write code here } module.exports = { Convert : Convert };
val = $val; } }*/ function Convert($pRootOfTree) { // write code here }
/* function TreeNode(x) { this.val = x; this.left = null; this.right = null; } */ function Convert(pRootOfTree) { // write code here }
# class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None # # # @param pRootOfTree TreeNode类 # @return TreeNode类 # class Solution: def Convert(self , pRootOfTree ): # write code here
package main import . "nc_tools" /* * type TreeNode struct { * Val int * Left *TreeNode * Right *TreeNode * } */ /** * * @param pRootOfTree TreeNode类 * @return TreeNode类 */ func Convert( pRootOfTree *TreeNode ) *TreeNode { // write code here }
/** * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * }; */ /** * * @param pRootOfTree TreeNode类 * @return TreeNode类 */ struct TreeNode* Convert(struct TreeNode* pRootOfTree ) { // write code here }