Given n, how many structurally unique BST's (binary search trees) that store values 1...n?For example,Given n = 3, there are a total of 5 unique BST's. 1 3 3 2 1
\ /...
分类:
其他好文 时间:
2015-08-31 13:38:37
阅读次数:
123
题目:Given acompletebinary tree, count the number of nodes.Definition of a complete binary tree fromWikipedia:In a complete binary tree every level, exc...
分类:
其他好文 时间:
2015-08-31 06:30:44
阅读次数:
317
题目:Invert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1代码: 1 public TreeNode invertTree...
分类:
其他好文 时间:
2015-08-31 06:27:39
阅读次数:
165
题目:Given a binary tree, return all root-to-leaf paths.For example, given the following binary tree: 1 / \2 3 \ 5All root-to-leaf paths are:["...
分类:
其他好文 时间:
2015-08-31 06:27:15
阅读次数:
171
题目:Given a binary search tree, write a functionkthSmallestto find thekth smallest element in it.Note:You may assume k is always valid, 1 ≤ k ≤ BST's t...
分类:
其他好文 时间:
2015-08-31 06:26:51
阅读次数:
202
Reference:http://blog.csdn.net/v_july_v/article/details/18312089http://leetcode.com/2011/07/lowest-common-ancestor-of-a-binary-tree-part-ii.htmlhttp:/...
分类:
其他好文 时间:
2015-08-31 06:22:39
阅读次数:
159
本次我们要使用C#的方式进行txt文件的读取和写入,在Unity的开发过程中同样适用,下面来具体实现吧。
创建文件的打开、关闭、读取、写入类:MyFileStream
要引入System.IO和System.Runtime.Serialization.Formatters.Binary和,一个是文件读取的IO类和另一个是二进制类,具体代码如下:
using UnityEngine...
二叉排序树BinarySortTree(二叉搜索树Binary Search Tree)...
分类:
编程语言 时间:
2015-08-31 01:10:59
阅读次数:
160
题目:将非递减有序的链表转化为平衡二叉查找树!参考的博客:http://blog.csdn.net/worldwindjp/article/details/39722643利用递归思想:首先找到链表的中间节点,于是链表被分为了由该中间节点划分开来的两部分。递归地处理这两部分,最终便得到了平衡二叉查找...
分类:
其他好文 时间:
2015-08-31 01:07:07
阅读次数:
200
1 Same Tree https://leetcode.com/problems/same-tree/ Given two binary trees, write a function to check if they are equal or not. Two binary trees are ...
分类:
编程语言 时间:
2015-08-30 20:55:05
阅读次数:
230