原题地址:http://oj.leetcode.com/problems/binary-tree-level-order-traversal/题意:二叉树的层序遍历的实现。解题思路:二叉树的层序遍历可以用bfs或者dfs来实现。这里使用的dfs实现,代码比较简洁。实际上,二叉树的先序遍历就是dfs实...
分类:
编程语言 时间:
2014-05-14 03:25:59
阅读次数:
428
今天碰到个很怪异的问题,如题关于mysql的ORDERBY语句和Limitoffset语句问题。bug再现下:select*fromAawherea.culomn1limit5offset0orderbya.culomn1asc则出现sqlException,提示orderby这行有问题。若将语句改为如下,将limit语句和orderby语句调换:select*fromAawherea.cul..
分类:
数据库 时间:
2014-05-13 01:14:39
阅读次数:
344
原题地址:http://oj.leetcode.com/problems/binary-tree-level-order-traversal-ii/题意:Given
a binary tree, return thebottom-up level ordertraversal of its node...
分类:
编程语言 时间:
2014-05-12 22:03:27
阅读次数:
581
原题地址:http://oj.leetcode.com/problems/binary-tree-zigzag-level-order-traversal/题意:Given
a binary tree, return thezigzag level ordertraversal of its nod...
分类:
编程语言 时间:
2014-05-12 22:02:26
阅读次数:
480
Spiral MatrixGiven a matrix ofmxnelements
(mrows,ncolumns), return all elements of the matrix in spiral order.For
example,Given the following matrix:[...
分类:
其他好文 时间:
2014-05-12 20:04:43
阅读次数:
268
Given an integern, generate a square matrix
filled with elements from 1 ton2in spiral order.For example,Givenn=3,You should
return the following matri...
分类:
其他好文 时间:
2014-05-12 19:53:23
阅读次数:
332
迭代法(Iteration)也称“辗转法”,是一种不断用变量的旧值递推出新值的解决问题的方法。...
分类:
其他好文 时间:
2014-05-12 14:56:47
阅读次数:
297
Given a singly linked list where elements are
sorted in ascending order, convert it to a height balanced BST.1.
将LinkedList的值保存到一个数组中,转化成Convert Sorte...
分类:
其他好文 时间:
2014-05-12 05:53:09
阅读次数:
367
链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=151
For each list of words, output a line with each word reversed without changing the order of the words.
This problem contains multi...
分类:
其他好文 时间:
2014-05-11 22:20:43
阅读次数:
443
offset大的时候的比较SELECT * FROM persons LIMIT
200000,10;耗时0.078sSELECT *FROM persons WHERE id>=(SELECT id FROM persons
ORDER BY id LIMIT 200000,1) LIMIT 10...
分类:
数据库 时间:
2014-05-11 16:23:57
阅读次数:
322