实现一个二叉搜索树迭代器。你将使用二叉搜索树的根节点初始化迭代器。调用 next() 将返回二叉搜索树中的下一个最小的数。注意: next() 和hasNext() 操作的时间复杂度是O(1),并使用 O(h) 内存,其中 h 是树的高度。 详见:https://leetcode.com/probl ...
分类:
其他好文 时间:
2018-04-07 16:07:42
阅读次数:
124
Collection Sort 、binarySearch Warning : 运行结果显示: [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10] [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9] [a5, a1, a2, a9 ...
分类:
编程语言 时间:
2018-04-07 14:00:26
阅读次数:
231
给定一棵二叉树,返回其节点值的后序遍历。例如:给定二叉树 [1,null,2,3], 1 \ 2 / 3返回 [3,2,1]。注意: 递归方法很简单,你可以使用迭代方法来解决吗?详见:https://leetcode.com/problems/binary-tree-postorder-traver ...
分类:
其他好文 时间:
2018-04-06 14:04:18
阅读次数:
162
原题链接: "https://leetcode.com/problems/binary tree paths/description/" 直接走一波深度优先遍历: 不过这道题目我的实现还是写复杂了,提交区有的是简洁高效的代码。。。都怪自己基础不好啊!!! ...
分类:
其他好文 时间:
2018-04-06 14:00:24
阅读次数:
145
软件包管理 API(Application Programming Interface):应用程序编程接口,API兼容,意味着开发库兼容,因此源代码可跨平台 ABI(Application Binary Interface):应用程序二进制接口,ABI兼容,意味着编译后的程序可跨平台 库为函数提供头 ...
分类:
其他好文 时间:
2018-04-06 12:29:58
阅读次数:
199
1064. Complete Binary Search Tree (30) A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties: The left ...
分类:
其他好文 时间:
2018-04-06 11:00:48
阅读次数:
205
1066. Root of AVL Tree (25) An AVL tree is a self balancing binary search tree. In an AVL tree, the heights of the two child subtrees of any node diff ...
分类:
其他好文 时间:
2018-04-06 10:52:02
阅读次数:
164
题目描述: Given two binary strings, return their sum (also a binary string). For example,a = "11"b = "1"Return "100". 要完成的函数: string addBinary(string a, s ...
分类:
其他好文 时间:
2018-04-05 21:05:46
阅读次数:
182
步骤一:引入IO文件和二进制格式序列化文件using System.IO;using System.Runtime.Serialization.Formatters.Binary;步骤二:将图书对象保存到文件(运用文件流存储图书列表)FileStream fs = new FileStream("b ...
分类:
其他好文 时间:
2018-04-05 01:20:31
阅读次数:
196
给定一个二叉树,确定它是高度平衡的。对于这个问题,一棵高度平衡二叉树的定义是:一棵二叉树中每个节点的两个子树的深度相差不会超过 1。案例 1:给出二叉树 [3,9,20,null,null,15,7]: 3 / \ 9 20 / \ 15 7返回 true 。案例 2:给出二叉树 [1,2,2,3, ...
分类:
其他好文 时间:
2018-04-05 01:13:24
阅读次数:
133