4.4.4 - ToC (Classification of algorithms) Flashcards

1
Q

How can the efficiency of an algorithm be measured

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

Explain what is meant by time complexity

A

The number of steps taken to complete an algorithm

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

Explain what is meant by space complexity

A

The amount of memory an algorithm takes up to complete

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

What are the three scenarios when determining the complexity of a problem

A
  • Worst-case scenario
  • Best-case scenario
  • Average-case scenario
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What scenario does the big-o use

A
  • The worst case scenario
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the 5 classification of big-o

A
  1. O(1) Constant Complexity
  2. O(n) Linear Complexity
  3. O(nˣ) Polynomial Complexity
  4. O(xⁿ) Exponential Complexity
  5. O(log n) Logarithmic Complexity
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What affect does the magnitude of the input have on the time taken an O(1) complexity algorithm

A

The time doesnt grow as the input size increases

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

What affect does the magnitude of the input have on the time taken an O(n) complexity algorithm

A

the time taken grows at the same rate as the magnitude of the input size grows.

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

What affect does the magnitude of the input have on the time taken an O(nˣ) complexity algorithm

A

time taken grows at a faster rate than the magnitude of the input size grows.

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

What affect does the magnitude of the input have on the time taken an (xⁿ) complexity algorithm

A

time taken grows at a much faster rate than the magnitude of the input size grows.

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

What affect does the magnitude of the input have on the time taken an O(log n) complexity algorithm

A

time taken halves as the magnitude of the input size grows

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

What factors limit what can be computed

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

When does hardware limit algorithms

A

When the hardware doesnt have enough memory for the algorithms

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

What algorithms have a BigO of O(n)

A
  • Linear Search
  • Binary Search Tree
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What algorithm have a BigO of O(log n)

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

What algorithms have a BigO of O(nˣ)

A
  • Bubble sort
  • Insertion sort
  • Quick Sort
17
Q

What algorithm have a BigO of O(n log n)

A
  • Merge Sort
18
Q

What algorithms have a space complexity of O(1) and why

A
  • Bubble Sort
  • Insertion Sort

No more arrays are made during the computation

19
Q

What is the space complexity of Merge Sort

20
Q

What is the space complexity of Quick Sort

21
Q

What is a tractable problem

A

Any problem that is solvable in polynomial time or less, meaning that the algorithm will run quick eneogh for it to be practical and useful

22
Q

What is an intractable problem

A

Any problem that can be solved, but cannot be solved in a polynomial time or less

23
Q

What is the Halting problem

A

the unsolvable problem of determining whether any program will eventually stop if given particular input.

24
Q

What is the significance of the Halting Problem

A

It determines what problems cannot be solved by a computer

25
Q

What is a heuristic problem

A

a method of finding a practical solution to an intractable problem that may not be the best

26
Q

How is a heuristic problem usually solved

A
  • By relaxing some of the constraints to the problem