CH 2 Fundamentals of Algorithm Analysis Flashcards

1
Q

What is an algorithms basic operation and why is it important?

A

The basic operation is the operation that contributes most to the total running time. (usually the most time consuming operation in the algorithms inner most loop).

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

What is the established framework for the analysis of an algorithms time efficiency?

A

Time efficiency is analyzed by determining the number of repetitions of the algorithms basic operation as a function of input size.

T(n) = kC(n) where k is the execution time for the basic operation, C(n) is the number of of times the basic operation is executed as a function of input size, and T(n) is the running time of the algorithm.

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

Big-O Definition

A

f(n) is upper bounded by g(n) if and only if there exists positive constants c and n_0 such that f(n) <= c(g(n)) for all n >=n_0.

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

Big-Omega Definition

A

f(n) is lower bounded by g(n) if there exists positive constants c and n_0 such that f(n) >= c(g(n)) for all n>= n_0.

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

Big-Theta Definition

A

f(n) is tightly bounded by g(n) if there exists positive constants c1, c2 and n0, s.t. c1g(n) <= f(n) <= c2(g(n)) for all n >=n0.

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

How to establish order of growth using limits?

A

Take the limit as n tends to infinity of f(n)/g(n).

  1. If the limit is zero, g(n) is rising faster than f(n), thus f(n) is O(g(n))
  2. If the limit is a positive constant, the, f(n) and g(n) have the same order of growth.
  3. If the limit is infinity, then f(n) is rising faster than g(n), thus f(n) is Big-Omega(g(n)).

(remember if the limit is indeterminate, we use L’Hospitals rule, tale the (derivative of numerator and denominator) then solve.)

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

Solve the constant summation:
n
∑c
i=1

A

= c+ c+ …. + c (n times) = c * n

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

Solve the arithmetic series:
n
∑i
​ i=1


.

A

= (n(n-1))/ 2

  • write the sum forward, then backward, then add them up pairwise.

S = 1 + 2+…+(n-1) + n
S = n + (n-1) +…+2 + 1

2S = n(n-1)
S = (n(n-1))/2

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