There are generally two methods to write DFS
algorithm, one is using recursion, another one is using stack. (reference from
Wiki Pedia)Pseudocode for ...
分类:
其他好文 时间:
2014-06-13 08:39:34
阅读次数:
218
题目描述Dominos are lots of fun. Children like to stand
the tiles on their side in long lines. When one domino falls, it knocks down the
next one, which k...
分类:
其他好文 时间:
2014-06-13 08:09:51
阅读次数:
318
Given an array of integers, every element
appears twice except for one. Find that single one.Note: Your algorithm should
have a linear runtime complex...
分类:
其他好文 时间:
2014-06-10 21:27:22
阅读次数:
284
Given two sorted integer arrays A and B, merge
B into A as one sorted array.Note:You may assume that A has enough space (size
that is greater or equal...
分类:
其他好文 时间:
2014-06-10 20:44:02
阅读次数:
298
Given an array of integers, every element
appears three times except for one. Find that single one.Note: Your algorithm
should have a linear runtime c...
分类:
其他好文 时间:
2014-06-10 20:42:48
阅读次数:
315
Question: Mergeksorted linked lists and return
it as one sorted list. Analyze and describe its complexity.Solution: Find the
smallest list-head first....
分类:
其他好文 时间:
2014-06-10 19:51:30
阅读次数:
278
1 class Solution { 2 public: 3 int
singleNumber(int A[], int n) { 4 int bits = sizeof(int)*8; 5 int result=0; 6
for(int i...
分类:
移动开发 时间:
2014-06-10 19:45:48
阅读次数:
334
The gray code is a binary numeral system where
two successive values differ in only one bit.Given a non-negative
integernrepresenting the total number...
分类:
其他好文 时间:
2014-06-10 19:38:39
阅读次数:
199
ChessboardTime Limit:2000MSMemory Limit:65536KTotal
Submissions:12800Accepted:4000DescriptionAlice and Bob often play games on
chessboard. One day, Al...
分类:
其他好文 时间:
2014-06-10 16:31:11
阅读次数:
261
The most strait forward approach is calculating
all the possible areas and keep the max one as the result. This approach needs
O(n*n) time complexity,...
分类:
其他好文 时间:
2014-06-10 16:11:31
阅读次数:
184