Guiding Principles of Analysis of Algorithms Flashcards

1
Q

What is the goal of these three principles?

A

to identify a sweet spot for the analysis of algorithms, one that balances of accuracy and tractability

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

The goal of Analysis of Algorithms

A

to have predictive power about whether an algorithm will be fast or slow in practice

this will allow us to paint an accurate picture of which algorithms tend to run faster than others

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

1st Guiding Principle: Worst-Case Analysis

A

worst-case analysis makes no assumptions about the inputs and simply gives a running time bound that is valid even for the ‘worst’ inputs

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

2nd Guiding Principles: Bigger Picture

A

we should not worry about small constant factors or lower-order terms in running time bounds

discards certain information and maintains focus on the bigger picture goal: providing guidance as to which algorithms tend to be faster than others

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

3rd Guiding Principle: Asymptotic Analysis

A

focus on the rate of growth of an algorithm’s running time as input size n grows large

the reason we care about the scale or large inputs is because it is with large inputs that we require algorithmic ingenuity.

Most algorithms will suffice for simple problems with small inputs on a modern computer

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

Our 3 Guiding Principles lead us to the following definition of a fast algorithm:

A

is an algorithm whose worst-case running time grows slowly with input size

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

Big O is meant to help us look at time and space as

A

valuable, yet limited, resources that we must use wisely.

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

Big O is concerned with

A
  1. readability
  2. scalability (time or speed, space or memory)

Big O allows us to measure the idea of scalable code. This is bc there’s no such thing as a free lunch. Knowing how much time and memory your code uses is critical as both are expensive resources for your company.

Big O is used to describe how efficient we can run our code with respect to time and space

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