Intro To Algorithms Flashcards

1
Q

Requirements of an Algorithm

A

Steps need to be in a very specific order

Steps also need to be distinct

Algorithm should produce a result

Completes in finite amount of time

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

Order of Growth or growth rate

A

How an algorithm performs as input set increases.

Standard for evaluating an algorithm.

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

Big O

A

Order of magnitude of completely.

Theoretical definition of the complexity of an algorithm as a function of the size.

Notation used to describe complexity.

O(n)

Only helpful in comparing algorithms that solve the same problem.

Upper bounds of algorithm (how it performs in worst case.)

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

O(1)

A

Constant time operation.

Runtime per operations is constant throughout the algorithm.

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

Linear time

A

Time it takes to run through a whole list in order or

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

O(log n)

A

Binary search complexity.

O = Order of magnitude of Complexity

Log= logarithm of N.

N= function of the size (size of list / array? Variable)

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

Order of run times by Big O notation

A

O(1) or Constant Time (checking to see if one variable matches another.

O (log n)

O (n)

O (n log n)

O (n^2)

O (n^k)

O(n log n)

O(n!)

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

Logarithm of N

A

When double value of N, number of operations only increases by 1. Also the inverse of an exponent.

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

O (ln n)

A

Another notation for logarithmic time. Same as O (log n).

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

Sublinear

A

Logarithmic run times which are faster than linear run times ?(or any run time below that)?

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

Quadratic Time

A

(remember a quadratic equation is when something is squared) O(n^2)

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

Cubic Runtime

A

O(n^3) less common, very computationally expensive.

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

Quasilinear Runtimes

A

O(n log n)

Between linear and quadratic run time.

Common in sorting algorithm.

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

Polynomial Runtime

A

Any algorithm where worst case run time is O(n^k) power. Considered efficient.

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

Factorial or Combinatorial run time

A

Factorial = 4! = 4x3x2x1 = 24

O(n!)

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