【题目】
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.
【题意】
给定一个已排序的数组(不存在重复元素),将它转换成一棵平衡二叉搜索树。
【思路】
由于平衡二叉树要求左右子树的高度差绝对值相遇等于1,也就是说左右子树尽可能包含相同数目节点。
则使用二分法来解本题即可。...
分类:
其他好文 时间:
2014-06-20 11:03:31
阅读次数:
246
【题目】
Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).
For example:
Given binary tree {3,9,20,#,#,15,7},
3
/ 9 20
/ 15 7
return its b...
分类:
其他好文 时间:
2014-06-20 09:42:30
阅读次数:
224
先上用来生成Tree的JSON数据 [ { "id": "Root", "name":
"资源目录" }, { "id": "PF", "name": "批发价格", "parent": "Root" }, { "id": "PF93",
"name": "93#", "parent": "
分类:
其他好文 时间:
2014-06-13 13:49:33
阅读次数:
442
一.Join语法概述join 用于多表中字段之间的联系,语法如下:... FROM
table1 INNER|LEFT|RIGHT JOIN table2 ON conditionatable1:左表;table2:右表。JOIN
按照功能大致分为如下三类:INNER JOIN(内连接,或等值连接)...
分类:
数据库 时间:
2014-06-13 13:28:02
阅读次数:
461
Given an array where elements are sorted in
ascending order, convert it to a height balanced BST./** * Definition for binary
tree * public class TreeN...
分类:
其他好文 时间:
2014-06-11 21:58:10
阅读次数:
300
Map总结:tree排序,hsah保证唯一性Map集合特点:该集合存储键值对,一对一对往里存,而且要保证键的唯一性。Map和Set很像,Set底层就是使用了Map集合。Map没有迭代器,要靠keySet和entrySet方法返回Set,在用迭代器。Map
|--Hashtable:底层是哈希表数据结...
分类:
其他好文 时间:
2014-06-11 09:42:38
阅读次数:
351
最初的代码源自free2000fly的一个标准的 COM 连接点接收器(Sink)的实现,
使用相当简单!!!,作者封装了不少工作,但调用时的代码还可以再封装一下,最后只要拷贝并修改Sink实现类的Invoke就好了。以下是这个代码的头文件
"sinkimpl.h",比free2000fly的"si...
分类:
其他好文 时间:
2014-06-11 09:38:08
阅读次数:
264
【题目】
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.
【题意】
将一个有序链表转换成平衡二叉树
【思路】
思路跟Convert Sorted Array to Binary Search Tree完全一样...
分类:
其他好文 时间:
2014-06-07 16:20:05
阅读次数:
287
离散化+暴力
Consecutive Blocks
Time Limit: 2 Seconds Memory Limit: 65536 KB
There are N (1 ≤ N ≤ 105) colored blocks (numbered 1 to N from left to right) which are lined up in a row. An...
分类:
其他好文 时间:
2014-06-07 13:08:07
阅读次数:
193
Saving HDU
Time Limit : 3000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other)
Total Submission(s) : 31 Accepted Submission(s) : 15
Font: Times New Roman | Verdana | Georgia
Font Si...
分类:
其他好文 时间:
2014-06-07 12:28:15
阅读次数:
334