Midterm Flashcards

1
Q

Analyzing algorithms gives us insight into how to design “good” algorithms, or improve a given algorithm.

A

True

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

The time and space required by an algorithm depends on

A

d) All options
a) Size of the input
c) Input of fixed-sized
b) Good or bad implementation

Answer: D) All options

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

The implementation of two algorithms to compare them is much faster than analyzing the code.

A

False

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

To predict time usage, we will use a good approximation of the number of elementary or basic steps which the algorithm performs.

A

True

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

If two inputs are the same size, the algorithm will not perform differently on them.

A

False

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

Compute the maximum number of basic operations performed by the algorithm for any input of fixed size is called worst-case analysis.

A

True

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

W(n) provides an upper bound on the number of basic steps performed by the algorithm.

A

True

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

Whenever you do a worst-case analysis, you must state

A

d) All Options
b) Basic Operation Counted
a) Input Size
c) Worst-case Input

Answer: D) All Options

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

In recursive call tree for recursive algorithms, the root node is the base case and leaf nodes are all initial calls.

A

False

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

The divide and conquer (recursion) way of coding is always better than iterative programming.

A

False

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

The NP-complete problem means:

A

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

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

lg(a/b) = lg a - lg b

A

True

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

n = 2^k -> k = lg n

A

True

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

lg n = (log n) / (log 2)

A

True

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

Average case analysis gives information on what happens most of the time.

A

True

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

W(n) always predicts the run time exactly.

A

False

17
Q

Consider two functions f(n) and g(n) which differ by a constant factor as being in the same complexity class i.e. if g(n) = c*f(n) for some constant c>0 then g(n) and f(n) should be considered to be in the same class.

A

True

18
Q

The complexity class of Theta(nlgn) is Logarithmic time.

A

False

19
Q

The complexity class of Theta(n^2) is Quadratic time.

A

True

20
Q

An inplace sort is a sorting algorithm that needs any extra space beyond that needed for the input.

A

False

21
Q

The divide and conquer problem solving is the best strategy for Fibonacci numbers.

A

False

22
Q

Use back substitution for smaller values, until you can guess a pattern.

A

True

23
Q

For n=2, the Strassen method takes 8 multiplications to solve C=A*B.

A

False

24
Q

The complexity of the ordinary matrix multiplication algorithm is Theta(n^3).

A

True

25
Q

x^log^(a^y) = y^log(a^x)

A

True

26
Q

Draw the recursive call tree for a small value of n, if the same subproblem is calculated numerous times in the call tree then this is probably an exponential time alg. In this case, use Dynamic Programming Strategy.

A

True

27
Q

Suppose that n is a power of 2. then we can apply Strassen’s algorithm recursively (i.e. using the divide and conquer strategy) by splitting the matrix into 4 equal pieces, and treating these pieces like the entries of the 2 x 2 matrix.

A

True

28
Q

If we count additions, subtractions, and multiplications of the ordinary algorithm then its order is Theta(n^2.81).

A

False

29
Q

The exchange sort is inplace sort.

A

True