Algorithms Flashcards

1
Q

What are Algorithms?

A

The fastest and most efficient set of steps to solve a problem.

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

How do you determine the necessary algorithm to use for a problem?

A

By breaking down the problem into steps and understanding the problem.

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

What are algorithms composed of?

A

A clear problem statement, expected input & expected output.

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

How do you measure the efficiency of an algorithm

A

Through calculating the Time & Space complexity

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

What is time complexity?

A

Simple the measure of how long an algorithm takes. Run or compute time.

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

What is space complexity?

A

A measure of how much memory was used in order to compute an algorithm.

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

What are the 3 cases to measure complexity against?

A

Best case, Average case, Worst case

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

The best case to test on is the worst case. What does “n” represent in the worst case?

A

The amount, length, or form of measure for a given input in an algorithm.

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

What is a linear algorithm?

A

An algorithm that executes steps that walks through a data structure/input in a sequential manner.

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

What is a binary algorithm?

A

An algorithm that executes steps within half of the data structure & continues to narrow down by half until a value is found.

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

What is “Big O”? (Upper bound)

A

A notation that represents the complexity of an Algorithm in the worst-case scenario

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

The O in “Big O” represents what?

A

Order of magnitude of complexity

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

The “(n)” is considered what?

A

The function of a size

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

Constant Time O(1) represents what?

A

The runtime per operation is the same no matter how large “n” or input data is.

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

O(log n) or O(ln n) represents what?

A

Logarithmic Runtime.

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

What is a Logarithmic Runtime (Sublinear)?

A

A runtime that is the inverse of exponentiation. When number of operations is logarithmic to the sample size (data).

17
Q

What is a Linear Runtime? O(n)

A

An algorithm that sequentially (step by step) moves through the input size.

18
Q

What is Quadratic Runtime? O(n2)

A

When an algorithm’s number of operation scales by n ^ 2 (input size squared) Big O of n squared

19
Q

What is Cubic Runtime? O(n3)

A

When an algorithm’s operations time scales w/ the input size by n ^ 3

20
Q

What is Quasilinear runtime? O(n log n)

A

Runs (log n) amount of operations per n or per input amount | Big O of n x log n

21
Q

What makes you have a long runtime?

A

The higher the amount of operations executed per n or input data results in longer runtime.

22
Q

What is Polynomial Runtime? O(n^k)

A

Means a runtime where its function of a size is squared, cubic or an exponent of some number.

23
Q

Is a Polynomial Runtime considered efficient?

A

Yes

24
Q

What are 2 bad runtime types?

A

Exponential Runtimes O(x^n)

Factorial Runtimes O(n!)