Memset
-
memset ( a , 0 , sizeof (a) )
: Set arraya
to -
memset ( a , -1 , sizeof (a) )
: Set arraya
to -
memset ( a , 0x3f , sizeof (a) )
: Set arraya
to
Define & Typedef
-
If it's not nessecery, DO NOT USE DEFINE, because it will make some problem that you can't think for.
-
MUST NOT use define to write the function like
min ( a , b )
, because if you use it likemin ( a (x) , b (x) )
, ifa (x)
is smaller thanb (x)
,a (x)
will be calculate for two times, it's much slow than the STL. -
If you want to write the type
long long
in another way, don't use#define int long long
, use this:
typedef long long ll
Online / Unline Algorithm
-
Online algorithm: Give the answer after every query.
-
Unline algorithm: Give the answer while all query is asked.
Orders
- DFS Order
-
In-Stack Order: The order that recursion a tree.
-
Out-Stack Order: As same as in-stack-order.
Explanations
-
DP: Dynamic Programming
-
LCA: Least Common Ancestors
-
RMQ: Range Minimum / Maximum Query