Data Representation | Program Representation | |||||
string int x[3] char x 0x9cd0f0ad 01101011 |
Objects Arrays Primitive types Addresses bits |
Java code C++ code C code x86 code IBCM hexadecimal |
High-level language Low-level language Assembly language Machine code |
int someInts[3];
someInts
is set to &someInts[0]
int* someInts = new int[3];
new
, the programmer must delete it: delete []
Array part | Address | Memory |
---|---|---|
&someInts[0] | 1000 | 2 |
&someInts[1] | 1004 | 4 |
&someInts[2] | 1008 | 6 |
... | ||
someInts | ??? | 1000 |
... |
This assumes that ints are 4 bytes in size
f(n) ∈ O(g(n)) means that there are positive constants c and n0 such that f(n) ≤ c*g(n) for all values n ≥ n0