EECS 233 Final Exam Cheat Sheet PDF
EECS 233 Final Exam Cheat Sheet PDF
EECS 233 Final Exam Cheat Sheet PDF
during class lifetime. Stack Storage: stores method parameters and local variables, for each method call a new stack frame is added to the top
of the stack, the stack pointer indicates the current pointer of stack memory allocation, when a method completes, its stack frame is removed and the values stored there are not preserved. Heap Storage: allocated using the new operator, referred to as
dynamic memory allocation because it is specified as part of the program and is determined at runtime, new returns the memory address of the start of the created object and is stored in the variable that represents the array/object. Abstract data type is
the model of a data structure that specifies: what operations can be performed on the data but not how these operations are implemented. n!, 2^n, 2^(n-1), (3/2)^n, n- n^2+5n^3, n^3+ log n, n^3, n^2, n log n, n, sqrt(n), (log n)^2, log n, log log n, 6
Pre: 7 5 2 4 6 9 8
post: 4 2 6 5 8 9 7
in: 2 4 5 6 7 8 9
level: 7 5 9 2 6 8 4
searching a binary
search tree:
best case: O(1)
worst case: O(h)
average case: O(h)
not balanced, an
extreme case:
height = n 1, and
worst-case time
complexity = O(n)
For a balanced tree
with n nodes: height =
O(log2n): worst-case
time complexity
=O(log2n)
bfTrav(origin)
origin.parent = null
create a new queue q
q.insert(origin)
while (!q.isEmpty()) v = q.remove()
visit v
for each vertex w in v's neighbors
if w is not encountered
mark w as encountered
w.parent = v;
q.insert(w);