DATA STRUCTURES 8 Flashcards
Ο( g(n) )
a ≤ b; f(n) ≤ cg(n)
Ω( g(n) )
a ≥ b; f(n) ≥ cg(n)
Θ( g(n) )
a = b; c₁g(n) ≤ f(n) ≤ c₂g(n)
ω( g(n) )
a > b; f(n) > cg(n)
ο( g(n) )
a < b; f(n) < cg(n)
O( n² )
bubble sort; Shell sort; quicksort; selection sort; insertion sort
O( log n )
binary search
When parameters are passed ______, the formal parameters of a function refer to _______ of the actual parameters which are discarded as soon as the function call returns.
by-value; copies
void addOne( long x )
passed by-value
void addOneByRef( long& x )
passed by-reference
Function overloading
Has to have different parameters. Can return different value types. Can have one version with 2 parameters and one with 3 parameters.
*p = ?
value of variable pointed to
p = ?
address of variable pointed to
&x = ?
address of variable
N + (N - 1) + … + 2 + 1 =
N(N+1)/2
Time for searching?
O( log n )
Time for Traveling Salesman?
O( n! )
Time for one loop?
O( n )
Time for a loop with in a loop?
O( n² )
Static memory is created on the _____?
Stack
Dynamic memory is created on the ____?
Heap
Dynamic memory must be ____ via _____?
released; delete
Static is freed when they go out of ____?
Scope
______ is a data structure that uses a ____ function to map identifying values, known as keys (e.g., a person’s name), to their associated values (e.g., their telephone number).
Hash Table; Hash