Midterm Flashcards

1
Q

What is the definition of Euer’s constant?

  1. N2/3
  2. The error calculated during a summation series.
  3. 0.57721566
  4. The sum of all the errors for a Taylor Series
A

0.57721566

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

What is proof by Induction?

  1. A recursive definition that shows the trivial case is true.
  2. Showing that that something is true for a certain number k, and then showing it is true for k+1.
  3. That the alternative is false.
  4. A proof that states that it must be true if no one can find where it is false.
A

Showing that that something is true for a certain number k, and then showing it is true for k+1.

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

What is the definition of a recursive function or routine?

A function that calls itself.
A function that cannot call itself.
A function that can be used inside of another function.
A function that returns no values.

A

A function that calls itself

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

What is the difference between a class and an object?

  A class is a definition while an object is the actual data.
  The object is the definition and the class is the actual data.
  There is no difference...they are the same thing.
  The class is the actual programming source code while the object is the executable.
A

A class is a definition while an object is the actual data.

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

Complexity Analysis measures _______ and _____

A

time and memory

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

____________ counts the number of operation that we expect to take the most time.

A

Operation Count

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

_____________ analysis describe the rate at which execution time increases in relation to the input size.

A

Asymptotic

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

The main focus of algorithmic analysis is the relationship between __________ and __________.

A

Running Time

Input Size

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

What are the two methods of analyzing algorithms?

A

Experimental Analysis

Theoretical Analysis

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

A type of analysis that requires algorithms to be coded and run to determine the results.

A

Experimental Analysis

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

f(n) = c

A

The constant function

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

Give three examples of operations defined by the constant function.

A

arithmentic Calculation, comparison operation, variable declaration, assignment statement, invoking a method or function.

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

Give an example of an algorithm that can be described using the logarithmic function?

A

binary search

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

Logorithmic functions grow __________ as the value of n grows?

A

Slower

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

The Linear function states that f(n) =

A

n

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

The size of the size of a linear function doubles when the input __________.

A

doubles

17
Q

The NlogN function is grows ________ than the linear function.

A

faster

18
Q

Give an example of an N-Log-N function.

A

merge sort

19
Q

A Quadratic function grows _________ than an N-Log-N function?

A

faster

20
Q

A nested loop represents what type of function?

A

Quadratic Function

21
Q

A bubble sort is what type of function?

A

Quadratic Function

22
Q

This notation represents the ___________ function

O(1).

A

Constant

23
Q

Assume that algorithm 1 takes
time t1(n) = 100n+n2
and algorithm 2 takes
time t2(n) = 10n2

If the function has 10 inputs which algorithm is faster?

A

t2

24
Q

Assume that algorithm 1 takes
time t1(n) = 100n+n2
and algorithm 2 takes
time t2(n) = 10n2

If the algorithm has 1000 inputs which is faster?

A

t1

25
Q

Assume algorithms with the following times
Algorithm 1: insert - n, delete - log n, lookup - 1
Algorithm 2: insert - log n, delete - n, lookup - log n

Which algorithm is faster for an application with many lookups and few inserts?

A

Algorithm 1

26
Q

What is the primary function of Asymptotic Complexity Analysis?

A

It compares the growth rate of two functions.

27
Q

What are two factors that are eliminated when performing Asymptotic Complexity?

A
constant multipliers (co-efficient)
lower-order effects
28
Q

What type of notation if described here

T(N) <= cf(N)

A

BIG O

29
Q

What type of notation if described here

T(N) >= cf(N)

A

Omega

30
Q

What type of notation if described here

T(N) = cf(N)

A

Theta

31
Q

What type of notation if described here

T(N) < cf(N)

A

Little O

32
Q

f(N) = N logN and g(N) = N^1.5

Which one grows faster??

A

g(N)

33
Q

Name the 4 steps in Complexity Analysis

A
Find the size of input n = size of the input
Find atomic operations
define f(n) as the number of atomic activities done by an input size of n.
define the complexity of the algorithm as the complexity of f(n)
34
Q

What is the complexity of the following?

for (int i = 0; i < n; ++i){
  //operation
  if( condition) break;
}
A

O(n)

35
Q
if(condition) 
	i = 0;
else
	for ( j = 0; j < n; j++)
		a[j] = j;
A

O(N)