Optimisation + Other Algorithms Flashcards

(35 cards)

1
Q

What is an optimisation algorithm?

A

An algorithm that finds the best possible solution to the problem proposed.

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

What is an example of an optimisation algorithm?

A

Dijkstra’s Shortest Path (DSP)

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

What does DSP do?

A

Calculates the shortest distance between a starting node to all other nodes in the graph

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

What is the efficiency of DSP?

A

O(n2)

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

What are the uses of DSP?

A
  • Shortest path between two locations in a transport network
  • Telephone and computer network planning
  • Network routing / packet switching
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

In what terms can algorithms be classified as?

A
  • Time complexity
  • Space required

for a given size of dataset

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

What is Big O notation

A

Used to describe time complexity of of algorithms, based on worst case scenario for that algorithm for a given dataset of size n

Convenient way to compare efficiency of algorithms and determine how well an algorithm will scale

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

What is a tractable algorithm?

A

An algorithm that can be solved within polynomial time: O(nk)

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

What are all the time complexities?

A
  • Constant complexity: O(1)
  • Logarithmic Complexity: O(logn)
  • Linear Complexity: O(n)
  • Polynomial Complexity: O(nk)
  • Exponential Complexity: O(xn)
  • (Factorial Complexity: O(n!) )
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is an intractable algorithm?

A

An algorithm that does not have a solution within polynomial time so is not practical for anything other than small n.

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

What are the properties of an algorithm with constant complexity?

A
  • Time Taken is constant so is independent of size of the dataset
  • As n increases the time taken stays the same
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are some examples of algorithms with a constant complexity?

A
  • Accessing an index in an array
  • Looking up a value in a hash table (assuming no collisions)
  • Popping from a stack or dequeueing from a queue
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are the properties of an algorithm with logarithmic complexity?

A
  • Time taken increases logarithmically with respect to the size of the database
  • The size of the problem set is halved after each iteration or recursive call
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are some examples of algorithms with a logarithmic time complexity?

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

What are the features of an algorithm with a linear time complexity?

A

Time taken increases proportionally with the size of the dataset

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

What are some examples of algorithms with a linear time complexity?

A
  • Linear Search
  • Traversing a linked list
17
Q

What are the properties of an algorithm with a polynomial complexity?

A
  • Time taken increases exponentially with the size of the dataset
  • At the limit of the tractability
18
Q

What are some examples of algorithms with a polynomial time complexity?

A
  • Bubble Sort
  • Dijkstra’s shortest path
19
Q

What are the properties of an algorithm with exponential complexity?

A
  • Time taken increases exponentially with size of dataset
  • Intractable
20
Q

What are some examples of algorithms with an exponential time complexity?

A
  • Brute force password cracking
  • Travelling Salesman Problem
21
Q

What are the number of different permutations for a set with size n?

22
Q

How to identify O(1)

A

No iteration or number of steps doesn’t depend on n

23
Q

How to identify O(n)

A

Single iteration that depends on n

24
Q

How to identify O(nk)

A

Nested iteration where each iterative structure depends on n and k is the iterative depth

25
How to identify O(logn)
Breaking down the problem into halves
26
How to identify O(xn)
Number of iterative structures/ recursive calls depends on n
27
What do you do if an algorithm has a combination of time complexities?
You select the worst Big O factor
28
What is a heuristic?
Rules based on the knowledge of a problem that can be used to find an approximate solution by changing some constraints in the problem or reducing the problem space. A heuristic approach employs a method of finding a solution that might not be the best. (reducing problem space or changing constraints)
29
What is the halting problem?
Determining whether a program will halt for a particular input without running the problem However, an algorithm cannot be written that can determine whether another algorithm will finish with a given input
30
What did the Halting Problem prove?
There was an example of a problem that is unsolvable
31
What was the significance of the Halting Problem?
Demonstrated that there are problems that are non computable - unsolvable by computers and even AI algorithms
32
Why are heuristics used?
A solution will arise within a reasonable time. However this may not be the best solution.
33
What is a heuristic approach
A heuristic approach employs a method of finding a solution that might not be the best. (reducing problem space or changing constraints)
34
What problems cannot be solved computationally?
Problems where there is no certain outcome or because limits of hardware make solving the problem with a certain outcome impractical
35
What is an unsolvable (non-computable) problem
A problem that can't be solved no matter how much time or computing power is devoted to it