Modelling With Algorithms Flashcards

1
Q

Key points of algorithms

A
  • set of instructions
  • finite number of steps
  • must work for any input
  • must have an end
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How can algorithms be written?

A

As text
As a flowchart
As pseudocode

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

What are some key points for algorithms using pseudocode?

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

How do we compare how well algorithms work?

A
  • the efficiency of an algorithm measures ‘run time’ and is usually proportional to the number of calculations that need to be carried out
  • the size of the problem is a measure of complexity so in the case of sorting algorithms it’s likely to be the number of elements in the list
  • the complexity of an algorithm measures efficiency as a function of the size of the problem. Complexity is indicated by the ORDER
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are the different methods for bin packing?

A
  • Full bin algorithm where we look for combinations that make full bins
  • First fit algorithm, where we put boxes into bins first fit in the order that they are already in starting from the first bin every time
  • first fit descending
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are some qualities of first fit algorithm?

A
  • heuristic (solves the problem but doesn’t find an optimal solution)
  • easy to carry out or program
  • can be inefficient
  • systemic approach
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are some qualities of the bin packing algorithm?

A
  • can be used in real life contexts (cutting a length of wood, parking vehicles in ferry lanes)
  • not guaranteed to give optimal solution
  • first fit decreasing is often more efficient than first fit
  • must remember to check from first bin onwards with each new item
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

When are sorting algorithms used?

A
  • when we want to sort a list of numbers into ascending order or words into alphabetical order
  • we may do this when we require a sorted list E.g to use first fit decreasing algorithm
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the quick sort algorithm?

A

Step 1: Select the pivot element (first element) from the list
Step 2: Write down all of the numbers that are smaller than the pivot in a sub-list to the left of the pivot, keeping the numbers in their original order. Write down all of the numbers that are larger than the pivot in a sub-list to the right of the pivot, keeping the numbers in their original order.
Step 3: Apply steps 1 and 2 to each separate sub-list until each sub-list contains only one number.

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

Look at Goodnotes for formulae and diagrams

A

:)

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

What are the dots and lines called in a graph?

A

Dots: nodes or vertices
Lines: arcs or edges

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

What is a graph?

A

A series of nodes/vertices connected by edges/arcs

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

How do you find the degree/order of a vertex?

A

Count how many ends of edges there are at the vertex

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

How do you know if a graph is impossible to draw?

A

Total order is odd

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

What is a loop

A

An edge that starts and ends at the same vertex

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