You are on page 1of 2

-- Variable declaration

char s[11] = "Hello\0" (s[5] = '\0')

#DEFINE ALIAS VALUE


typedef <Existing_Data-Type> NewTypeName
typedef struct <NAME> {
var_1 name_1;
var_2 name_2;
} <NAME_T>

-- Big-Oh Notation O
* <= g(n)
f(n) <= c.n
- c >= 0, n >= n0 >= 1
- pick any c and n0 make the statement valid

-- Big-Omega Ω
* >= g(n)
- f(n) ≥ c·g(n) ∀n ≥ n0

-- Big-Theta Θ
* = g(n)
c'·g(n) ≤ f(n) ≤ c''·g(n) ∀n ≥ n0

-- Memory
char: 1 byte
int: 4 bytes
float: 4 bytes
double: 8 bytes
<Type> *: 8 bytes(pointer)

int a[6];
int *p;
p = &a; // p: 0x1000 (HEX)
p = p+1;// p: 0x1004 (int:4 byte)

code
fixed-size, read-only region
machine code instruction
global data
fixed-size
global variables(RW)yes, constant strings(R)
heap
dynamic data structures created by malloc
stack
dynamically allocated data(function, local variable)

--
int main(int argc, char *argv[])
argc: number of arguments (include execute fie)
argv argument value(0: execute file name)

-- Graph
V: Vertex/Vertices
E: Edges
V ( V −1 )
Maxedges =
2

Storage Initialization Insert Edge Find Edge Delete Edge


Array-Edge O(E) O(1) O(1)* O(E) O(E) *Space is not full
Takes O(E) if need to allocate
larger space,
Binary search(O(log E)) if
edge is in order
Adjacency O(V2) O(V2) O(1) O(1) O(1)
Matrix
Adjacency O(V+E) O(V) O(1) O(V) O(V)
List

Disconnected isPath(x, y) Copy Graph Destroy Graph


Array-Edge O(E) O(ElogV) O(E) O(1)
Adjacency O(V) 2
O(V ) 2
O(V ) O(V)
Matrix
Adjacency O(1) O(V+E) O(E) O(E)
List

You might also like