Midterm Flashcards
Analyzing algorithms gives us insight into how to design “good” algorithms, or improve a given algorithm.
True
The time and space required by an algorithm depends on
d) All options
a) Size of the input
c) Input of fixed-sized
b) Good or bad implementation
Answer: D) All options
The implementation of two algorithms to compare them is much faster than analyzing the code.
False
To predict time usage, we will use a good approximation of the number of elementary or basic steps which the algorithm performs.
True
If two inputs are the same size, the algorithm will not perform differently on them.
False
Compute the maximum number of basic operations performed by the algorithm for any input of fixed size is called worst-case analysis.
True
W(n) provides an upper bound on the number of basic steps performed by the algorithm.
True
Whenever you do a worst-case analysis, you must state
d) All Options
b) Basic Operation Counted
a) Input Size
c) Worst-case Input
Answer: D) All Options
In recursive call tree for recursive algorithms, the root node is the base case and leaf nodes are all initial calls.
False
The divide and conquer (recursion) way of coding is always better than iterative programming.
False
The NP-complete problem means:
d) None of above
b) It is considered highly unlikely an efficient algorithm exist
c) Both a and b
a) Don’t know an efficient algorithm
Answer: C) Both a and b
lg(a/b) = lg a - lg b
True
n = 2^k -> k = lg n
True
lg n = (log n) / (log 2)
True
Average case analysis gives information on what happens most of the time.
True