1、
??
Balanced Binary Tree
Given a binary tree, determine if it is height-balanced.
For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subt...
分类:
其他好文 时间:
2014-05-23 08:19:19
阅读次数:
282
uva 548 Tree
题目大意:
给定一个二叉树的中序和后序遍历,求二叉树到每个叶节点的路径和最小的那个叶节点的值。
解题思路:
先建树,后dfs,建树也就是后序的最后一个就是二叉树的当前节点的值,再在中序中找到这个值,那么左边就是左子树,右边就是又子树,再从后序中找出相应的左右子树的后序,然后划分为子问题递归求解。...
分类:
其他好文 时间:
2014-05-23 08:10:59
阅读次数:
255
1、
??
Convert Sorted List to Binary Search Tree
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.
分析:将一个升序排列的链表转换为平衡二叉搜索树,采用递归的方式,先找到链表...
分类:
其他好文 时间:
2014-05-22 12:33:30
阅读次数:
270
当我们使用Destructive Method对wrapper set进行选择、过滤之后会产生一个新的结果集。例如:
html
$lt;div$gt;
$lt;p$gt;Paragraph$lt;/p$gt;
$lt;p$gt;Paragraph$lt;/p$gt;
$lt;/div$gt;
对于上面的DOM Tree,当然可以使用
$('div').find('p')
来获取所...
分类:
Web程序 时间:
2014-05-22 10:41:21
阅读次数:
430
_hashMap.insert(pair<String,HASH_TABLE*>(tmp,hashtabletmp));这句会报segment或abort错误经同事帮看,也翻来覆去自查,终于发现原来是malloc中hTable->hList=(pHASH_ENTRY)malloc(hTable->listLen*(HASH_ENTRY_SIZE));这句写成了hTable->hList=(pHASH_ENTRY)..
分类:
其他好文 时间:
2014-05-20 20:20:34
阅读次数:
288
今天在伯乐在线 一道面试题看 HashMap 的存储方式,也即使问:在 HashMap 中存放的一系列键值对,其中键为某个我们自定义的类型。放入 HashMap 后,我们在外部把某一个 key 的属性进行更改,然后我们再用这个 key 从 HashMap 里取出元素,这时候 HashMap 会返回什么?如何面试者直接答“这要看自定义类型的hash值了”,我想面试官会非常满意,抓住问题关键很重要。联...
分类:
编程语言 时间:
2014-05-20 14:44:43
阅读次数:
321
戳我去解题Given an array where elements are sorted in
ascending order, convert it to a height balanced
BST.分析:因为BST中序序列是升序的,所以中序遍历序列最中间的元素一定是根节点,然后左右递归构建二叉...
分类:
其他好文 时间:
2014-05-20 11:38:16
阅读次数:
233
struct dx_rootHtree的内部节点:struct
dx_nodeHtree树根和节点中都存在的Hash map:struct
dx_entry1.20扩展属性EA扩展属性(xattrs)通常存储在磁盘上的一个单独的数据块中,通过inode.i_file_acl*引用。扩展属性的第一应用...
分类:
其他好文 时间:
2014-05-20 11:07:57
阅读次数:
675
戳我去解题Given two binary trees, write a function to
check if they are equal or not.Two binary trees are considered equal if they are
structurally identic...
分类:
其他好文 时间:
2014-05-20 10:09:37
阅读次数:
201