Chapter 2 Flashcards

1
Q

Define Efficiency

A

An algorithm is efficient if it has a polynomial running time.

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

Define Polynomial Time

A

a polynomial-time algorithm is one whose running time T(n) is O(n^d) for some constant d, where d is independent of the input size.

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

What is the asymptotic upper bound for a polynomial?

A

Let f be a polynomial of degree d, in which the coefficient ad is positive. Then f = O(n^d).

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

What is the asymptotic upper bound for a logarithm?

A

For every b>1 and every x>0, we have logb n=O(n^x).

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

What is the asymptotic upper bound for an exponent?

A

For every r>1 and every d>0, we have n^d=O(r^n).

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

What is a common trait among linear time algorithms?

A

They can be linear time because they spend a constant time on each input received or for subtler reasons (see explanation of merging 2 sorted lists in textbook)

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

What is a common trait among O(n log n) time algorithms?

A

it is the running time of any algorithm that splits its input into two equal-sized pieces, solves each piece recursively, and then combines the two solutions in linear time.(i.e MergeSort)

Can also be encountered when the most expensive step of an algorithm is to sort input.

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

What is a common trait among O( n^2) time algorithms?

A

Looping through 2 loops

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

What is a common trait among O(log n) time algorithms?

A

O(log n) arises as a time bound whenever we’re dealing with an algorithm that does a constant amount of work in order to throw away a constant fraction of the input.

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