自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

caisense的专栏

诗和远方

  • 博客(4)
  • 收藏
  • 关注

原创 108. 将有序数组转换为二叉搜索树

https://leetcode-cn.com/problems/convert-sorted-array-to-binary-search-tree/description/ 思路:递归,根据有序的特性,每次取数组中点mid为根,递归构造左右子树# Definition for a binary tree node.# class TreeNode:# def __init__...

2018-09-13 17:54:05 221

原创 107. 二叉树的层次遍历 II

https://leetcode-cn.com/problems/binary-tree-level-order-traversal-ii/description/ 思路:层序遍历,然后结果倒序# Definition for a binary tree node.# class TreeNode:# def __init__(self, x):# self...

2018-09-13 17:50:42 206

原创 106. 从中序与后序遍历序列构造二叉树

https://leetcode-cn.com/problems/construct-binary-tree-from-inorder-and-postorder-traversal/description/ 思路:和105题类似,区别在于后序的-1号元素是中序的根,划分之后递归# Definition for a binary tree node.# class TreeNode:# ...

2018-09-13 17:49:03 126

原创 105. 从前序与中序遍历序列构造二叉树

https://leetcode-cn.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/description/思路:递归,易知前序的第0号元素为树的根,在中序里找这个根,然后以该根为界将中序数组划分成左右两半,依次递归进行。难点在于每次还要根据中序的划分来将前序数组也划分。# Definitio...

2018-09-13 17:47:15 166

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除