students book Flashcards

1
Q

Kruskal’s algorithm - how does it work?

A

1) sort all the arcs into ascending order
2) Select the arc of least weight
3) If the next one forms a cycle reject it, if not add it to the spanning tree
4) Repeat until all vertices are connected

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

Binary search - how does it work?

A

1)To an ordered list, select the midpoint - given by the formula
0.5 (n+1) and round up - that’s the first pivot
2) The search is complete when the first pivot is the item we are locating, if not look at the first or second half of the list that most likely contains the item.
3) if the item is not yet located, use a second pivot and so on
4) if the item is not found then the item is missing from the list

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

Prim’s algorithm

A

1) choose a vertex to start the tree ( usually already known)
2)Select an arc of least weight that joins a vertex already in the tree. Choose any if there is a choice between arcs of equal weight
3) repeat until all vertices are connected
4) list the arcs in order they have been selected

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

Quick sort algorithm

A

1) choose the item at the midpoint of the list aka the pivot
2) write down the items that are less on one side and those that are bigger on the other, remember to write them in the same order they are given.
3) write down the 2nd and 3rd pivots of the two sublists.
4) add other pivots to each sublist until the list is sorted
The number of pivots double at each pass

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

Bubble sort

A

1) start at the beginning and work from the e left to the right comparing adjacent items. If they are in order, leave them. If not, swap them. After the first pass, the last item is in it’s final position
2) Continue with next passes until the list is sorted, when no swaps are made.

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

Eulerian graph/circuit

A

graph which contains a trail that includes every edge and starts and ends at the same vertex - called the Eulerian circuit.
Any connected graph whose vertices have even valencies is Eulerian

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

Semi-Eulerian graph

A

graph containing a trail which starts and finishes at different vertices. Usually those two with an odd valency.
Any connected graph with exactly 2 odd vertices are Semi-Eulerian

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

Nearest neighbour algorithm

A

Works only on a least distance matrix between each node, used in the travelling salesman problem - does not find an optimal solution
1) choose any vertex to start the path
2) Select an arc of least weight which joins a new vertex to the last vertex added ONLY
3) Repeat until all vertices are added

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

Route inspection algorithm

A

1) identify any vertices with odd degrees
2) consider all possible complete pairings of these vertices, select those with the least sum
3) add a repeat of the arcs indicated by this pairing to the network

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

Travelling salesman problem

A

using a min spanning tree method to find an upper bound for the practical TSP:
1) find the minimum spanning tree, enter Prim or Kruskal algorithm
2) double the minimum connector such that the cycle is completed
3) try to find shortcuts on the way back ( the non-included arcs might be useful)

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

walk

A

a route through a graph along the edges from one arc to another

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

path

A

a walk in which no vertex is visited more than once

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

trail

A

a walk in which no edge in visited more than once

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

cycle

A

a walk in which the end vertex and start vertex are the same and no one is visited more than once

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

hamiltonian cycle

A

cycle that includes every vertex

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

connected graph

A

graph where all the vertices are connected

17
Q

loop

A

an edge that starts and ends at the same vertex

18
Q

simple graph

A

graph with no loops in which there is at most one edge connecting a pair of vertices

19
Q

Euler’s handshaking lemma

A

the sum of the degrees of the vertices = 2x the number of edges. so the the number of odd nodes must be even

20
Q

tree

A

connected graph with no cycles

21
Q

complete graph

A

graph in which every vertex is directly connected by a single edge to each of the other vertices, referred to as Kn graphs, for instance K3 K5 K8, etc.

22
Q

isomorphic graphs

A

graph displaying the same information but in a different manner