Analysis of Algorithms Flashcards

1
Q

A set of steps to accomplish a task

A

Algorithm

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

2 things we want from a computer algorithm

A

Correctness
Efficient Resource Usage (CPU, Memory)

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

The theoretical study of computer-program performance and resource usage.

A

Analysis of Algorithms

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

An algorithm that gives a correct solution but takes a long time might
be of little to no value.

A

Time Complexity

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

Algorithms can be analyzed base on ________ and _________ complexities

A

Time and Space

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

_____________ is the primary measure of efficiency.

A

Time

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

Factors that can affect runtime

A

speed of the computer
programming language
compiler/interpreter
other programs running

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

2 Types of Run Time Analysis

A

Empirical and Theoretical Analysis

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

Implement the algorithm, then run with a timer.

A

Empirical Analysis

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

We determine how long the algorithm takes as a function of the
size of its input: T(n).

A

Theoretical Analysis

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

We focus on how fast the function that
characterizes the running time _______ with the input size.

A

grows

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

We focus on how fast the function that characterizes the running time grows with the input size.

A

Theoretical Analysis

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

Upper Bound

A

O-notation (Big O)

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

is used to describe the upper bound or the maximum possible running time of the algorithm.

A

The O- notation

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

O(g(n)) is a set of functions f(n) such
that there exists positive constants c and n0
such that 0 ≤ f(n) ≤ cg(n) for all n ≥ n0

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

the upper bound is a __________________

A

guarantee

17
Q

The running time of an algorithm on a particular input is the number of _______________ or _______ executed.

A

primitive operations or steps

18
Q

Running time of loops:

At most the running time of the statements inside the loop times the
number of _________.

A

iterations

19
Q

Running time for consecutive statements

A

Get the maximum

20
Q

Running time for conditional statements

A

The running time of the test + the running time of the two branches.

21
Q

is the minimum number of times a piece of code is executed.

A

best-case running time

22
Q

is the maximum number of times a piece of code is executed.

A

worst-case running time

23
Q

Linear Search Best and Worst Case Run time

A

Best: O(1) at index 0
Worst: O(n) at index n-1 or not in the list

24
Q

Binary Search Best and Worst Case Run time

A

Best: O(1) at middle
Worst: O(log n)

25
Q

An algorithm is O(log n) if it _____________________________________
(usually by 1⁄2).

A

cuts the problem size by a fraction