WEEK 2: ALGORITHM EFFICIENCY Flashcards
(40 cards)
a loop that does a fixed number of operations n times is ____
O(n)
this is the maximum number of operations for inputs of a given size
worst-case
this is the average number of operations for inputs of a given size
average-case
this is the fewest number of operations for inputs of given size
best-case
2 types of complexity analysis used to assess the efficiency of algorithms
computational complexity, asymptotic complexity
measure of how much effort is needed to apply an algorithm, or how much it costs
computational complexity
these are the 2 factors measured in complexity analysis
time and space
computational complexity is dependent in these 2 aspects
platform/system dependent & language dependent
true or false: comparing algorithms can be done on different machines or different programming languages
false
true or false: when comparing algorithm efficiencies, real-time units such as microseconds and nanoseconds are to be used
false
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
true
if t = cn, then an increase in the size of data increases the execution by the same factor
linear relationship
in mathematics, this is the power to which a base, such as 10, must be raised to produce a given number
logarithm n
if t = log2n, then doubling the size ‘n’ increases ‘t’ by one time unit
logarithmic relationship
in linear relationships, if t=cn, then an increase in the size of data increases the execution time by _________
the same factor
in logarithmic relationships, if n = log2n, then doubling the size ‘n’ increases ‘t’ by ______
one time unit
true or false: any terms that do not significantly affect the outcome of a function cannot be eliminated
false
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 ___________
asymptotic complexity
this is a part of the theory of computation dealing with the resources required during computation to solve a given problem
complexity theory
how many steps it takes to solve a problem
time
how much memory it takes to solve a problem
space
another resource that can be considered in asymptotic complexity
how many parallel processors are needed to solve a problem in parallel
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
big-o notation