0%

A polynomial time Monte-Carlo algorithm which produce a good approximation solution to an enumeration problem for which it is known that the computation of the exact solution is very hard.

Read more »

1
2
3
4
5
6
7
switch (integer expression)
{
case label1 : statement(s)
case label2 : statement(s)

default : statement(s)
}

其中integer-expression必须为结果为整数值的表达式(如int, char,或者enum枚举量)。switch中的case标签只是行标签,而不是选项之间的界限,如果没有明确的break语句,程序将以此执行之后的所有语句。

Read more »

C++ sizeof 关键字

sizeof 是一个关键字,用于判断变量或数据结构的字节大小,使用语法如下:

1
sizeof(datatype)

Definition from msdn

The sizeof keyword gives the amount of storage, in bytes, associated with a variable or a type (including aggregate types). This keyword returns a value of tyoe size_t.

Read more »

Trie is an efficient information reTrieval data structre (especially for string), which supports serach, insert and delete operations. Maximum number of children of a node is equal to size of alphabet. Using Trie, search complexities can be brought to optimal limit (key length).

Read more »

Data Structure

1
2
3
4
5
6
7
// Definition for a binary tree node
struct TreeNode {
int val;
TreeNode* left;
TreeNode* right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
}
Read more »