Decision Flashcards

(26 cards)

1
Q

Give the steps of a bubble sort
(Decision)

A

Compare first two values
Swap if in wrong order
Repeat for all values, moving from left to right
Repeat until no swaps in pass, ignoring the furthest item right each time

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

Give the steps of a quick sort

A

Select the middle number of the list to be the pivot
Place the numbers to the left or right of the pivot based on where they are in the sorted list
Repeat until every number has been selected as a pivot

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

Define the first fit bin packing algorithm

A

Beginning with the first item, place each element into the first bin it fits in

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

Define the first fit decreasing bin packing algorithm

A

Order the objects in descending order of size
Starting with the largest, apply the first fit algorithm

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

Define the full bin packing algorithm

A

Choose elements which will entirely fill a bin and place them together
Place other elements using the first fit algorithm

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

Give pros and cons of the first fit algorithm

A

Fast
No need to sort objects

Rarely provides optimal solution

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

State how to calculate the lower bound for bin packing algorithms

A

Total size of all objects / bin capacity
Take ceiling

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

Give pros and cons of the first fit decreasing algorithm

A

Usually close to optimal solution

Requires list to be sorted
Takes longer than first fit

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

Give pros and cons of the full bin algorithm

A

Usually provides close to optimal solution

No guarantee better than first fit decreasing
Difficult to program computer to do

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

Give an example of an algorithm with linear order

A

Finding an item in unsorted list

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

Give an example of an algorithm with quadratic order

A

Bubble sort
Quick sort
Shortest path

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

Give an example of an algorithm with cubic order

A

Minimum connector
Dijkstra’s algorithm

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

Describe a distance matrix

A

Distance from element on side to element on top in table e.g.

A B C
A - 10 -
B 10 - 1
C - 1 -

Link of distance 10 from A to B
Link of distance 1 from B to C

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

Describe an adjacency matrix

A

Shows number of paths between points e.g.

A B C
A - 2 -
B 2 - 1
C - 1 -

2 paths directly from A to B
1 path directly from B to C

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

Define the degree of a vertex

A

Number of arcs that meet at that node

Note: a path from a node to itself counts as 2

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

Define a subgraph

A

A graph from the original with vertices and edges which are subsets of the original

17
Q

Define a walk

A

Route on a graph from one vertex to the next

18
Q

Define a path

A

A finite sequence of edges where no vertex is visited more than once such that the end of one edge is the start of the next

19
Q

Define a trail

A

A walk where no edge is visited more than once

20
Q

Define a cycle

A

A walk with the same start and end vertex and where no other vertex is visited more than once

21
Q

Define a Hamiltonian Cycle

A

A cycle which includes every vertex

22
Q

Define a connected graph

A

A graph with all of its vertices connected

23
Q

Define a loop on a graph

A

An edge that starts and finishes at the same vertex

24
Q

Define a tree

A

A connected graph with no cycles

25
Define a spanning tree
A tree which includes all vertices
26
Define a complete graph
A graph where every vertex is directly connected to every other vertex E.g. full mesh