WEEK 2: ALGORITHM EFFICIENCY Flashcards

(40 cards)

1
Q

a loop that does a fixed number of operations n times is ____

A

O(n)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

this is the maximum number of operations for inputs of a given size

A

worst-case

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

this is the average number of operations for inputs of a given size

A

average-case

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

this is the fewest number of operations for inputs of given size

A

best-case

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

2 types of complexity analysis used to assess the efficiency of algorithms

A

computational complexity, asymptotic complexity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

measure of how much effort is needed to apply an algorithm, or how much it costs

A

computational complexity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

these are the 2 factors measured in complexity analysis

A

time and space

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

computational complexity is dependent in these 2 aspects

A

platform/system dependent & language dependent

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

true or false: comparing algorithms can be done on different machines or different programming languages

A

false

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

true or false: when comparing algorithm efficiencies, real-time units such as microseconds and nanoseconds are to be used

A

false

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

true or false: in comparing algorithm efficiencies, logical units representing the relation ship between ‘n’ the size of the file, and ‘t’ the time taken to process the data should be used

A

true

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

if t = cn, then an increase in the size of data increases the execution by the same factor

A

linear relationship

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

in mathematics, this is the power to which a base, such as 10, must be raised to produce a given number

A

logarithm n

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

if t = log2n, then doubling the size ‘n’ increases ‘t’ by one time unit

A

logarithmic relationship

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

in linear relationships, if t=cn, then an increase in the size of data increases the execution time by _________

A

the same factor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

in logarithmic relationships, if n = log2n, then doubling the size ‘n’ increases ‘t’ by ______

A

one time unit

17
Q

true or false: any terms that do not significantly affect the outcome of a function cannot be eliminated

18
Q

any terms which don’t significantly affect the outcome of the function can be eliminated, producing a function that approximates the functions efficiency. this is called ___________

A

asymptotic complexity

19
Q

this is a part of the theory of computation dealing with the resources required during computation to solve a given problem

A

complexity theory

20
Q

how many steps it takes to solve a problem

21
Q

how much memory it takes to solve a problem

22
Q

another resource that can be considered in asymptotic complexity

A

how many parallel processors are needed to solve a problem in parallel

23
Q

this is used to give an asymptotic upper bound for a function, i.e. an approximation of the upper bound of a function which is difficult to formulate

A

big-o notation

24
this is the lower bound equivalent of the big-O notation
big-Ω (omega notation)
25
this denotes the number of steps an algorithm requires to solce a specific problem
runninng time
26
in general, the running time of an algorithm depends on these 2 factors
size of the problem, repsective input
27
this represents tight bound
Θ(n)
28
complexity where the there is a constant number of operations, not depending on the input data size
constant - O(1)
29
complexity where the number of operations proportional of log2n where n is the size of the input
logarithmic - O(logn)
30
complexity where the number of operations is proportional to the input data size
linear - O(n)
31
in this complexity, the number of operations is proportional to the square of the size of the input data
quadratic - O(n^2)
32
in this complexity, the number of operations is proportional to the cube of the size of the input data
cubic - O(n^3)
33
in this complexity, there is an exponential number of operations; fast growing
exponential - O(2^n), O(k^n), O(n!)
34
if a program takes a lot of time, you can still run it, and just wait longer for a result. however, if a program takes a lot of _______, you may not be able to run it at all.
memory
35
for this, space complexity is usually just a matter of looking at the variable declarations and storage allocation calls
iterative program
36
analysis of this type of program is more complicated; the space used at any time is the total space used by all recursive calls active at that time
recursive program
37
true or false: in recursive program space complexity, each recursicve call takes a quadratic amount of space
false; constant
38
generally defined as a function of the number of elements being processed and the type of loop being used
algorithm efficiency, f(n)
39
true or false: calculating the average case complexity is easier than calculating approximations in the form of big-O, big-Ω, and big-Θ
false; average-case is difficult