Week 2: Analysis of Algorithms Flashcards

1
Q

What are the criteria we can use to compare algorithms? What are the most important ones?

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

What is complexity of an algorithm? What is space complexity? Time complexity?

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

What does a complexity function look llike? What can it not look like?

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

The complexity of an algorithm depends on:

A

The input itself, not only the size.

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

What are the three kinds of complexity functions?

A

Best case complexity

Least amount of resources needed by the algorithm to solve an instance of the problem of size n. (when the number is at the beginning of an array in a search algorithm.

Worst case complexity:

Largest amount of resources needed by the algorithm to solve an instance of the problem of size n.

Average case complexity:

Every instance has its own complexity: find each complexity and find the average

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

Does the size of the input n have anything to do with worst/best case complexity? I.e, does having a small input n mean best case?

A

No the best and worst case complexities are independant of the size of input n.

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

What things do you need to measure the complexity of an algorithm?

A
  • Computer
  • Compiler for the programming language in which the algorithm will be implemented
  • An operating system
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are the drawbacks of the measuring complexity in the experimental way?

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

The goal is to compute time complexity without____

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

We can compute complexity by analyzing an algorithm’s ______

A

Pseudocode

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

What are primitive/basic operations? What does it mean for something to be a constant in an algorithm?

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

How can we determine the complexity of an algorithm?

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

Why do we use asymptotic notation?

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

What is Asymptotic notation? How is it expressed? What do the variables mean?

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

Examples of computing the order of a function:

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

Another example of computing the order of a function:

A
17
Q

Disproving an order of a function:

A

Use proof by contradiction

18
Q

What are the primitive operations in this example?

A
19
Q

What is the first/hardest method for computing the complexity of an algorithm?

A
20
Q

What is the second method for computing complexity?

A
21
Q

What is the easiest method of computing complexity?

A
22
Q

What is the first rule for computing the order of a function?

A
23
Q

What is the second rule for computing the order of a function?

A
24
Q

Do the following examples for computing the order of a function:

A