MWA Flashcards

1
Q

Define an algorithm

A

a finite sequence of operations for carrying out a procedure or solving a problem

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

define heuristic algorithm

A

a algorithm which will usually find a solution efficiently but has no guarantee it is optimal

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

Are first fit and first fit decreasing heuristic or not

A

they are heuristic

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

what is the worst case complexity of First fit and First fit decreasing

A

O(n2)

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

What is the worse case amount of comparisons for First fit and First fit decreasing

A

1/2 n(n+1)

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

What is the worse case complexity of the quick sort algorithm

A

O(n2)

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

what is a pass

A

when you have completed an algorithm once

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

In quick sort what is the pivot

A

The first number in each sub-list

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

what is the worse case scenario number of comparisons in a quick sort

A

1/2 n(n−1)

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

what is a graph

A

a set of nodes (or vertices) together with a set of arcs (or edges).

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

what is a loop

A

an edge with the same vertex at both ends

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

what is the order of a node

A

is the number of edges incident on it.

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

how else can a graph be represented

A

by an incidence matrix.

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

what is a connected graph

A

one in which every vertex is joined, directly or indirectly, to each of the other vertices.

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

what is a simple graph

A

a graph with no loops and no ‘repeated’ edges.

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

what is a simply connected graph

A

a graph that is both simple and connected.

17
Q

what is a tree

A

a simply connected graph with the minimum possible number of arcs and no cycles

18
Q

how many edges does a tree have based on vertices

A

n-1

19
Q

what is a complete graph

A

A simply connected graph with the maximum possible number of arcs

20
Q

How many edges does a complete graph have

A

1/2 n(n−1)

21
Q

what is a digraph

A

a graph where some of the arcs are directed. The incidence matrix for a digraph will usually not be symmetric about the leading diagonal.

22
Q

what is a bipartite graph

A

where the vertices partition into two sets and edges cannot join vertices that are in the same set.

23
Q

what is a network

A

a graph with weighted arcs

24
Q

What is the complexity of kruskal’s, prim’s and dijkstra’s algorithm

A

O(n2)

25
Q

How do you perform kruskal’s algorithm

A
  • Start at smallest and work up
  • No cycles allowed
    Finding MST
26
Q

How do you perform Prim’s algorithm

A
  • Start anywhere (or told specific vertex)
  • Select shortest edge coming out of initial vertex
  • Then select edge with least weight which doesn’t create cycle from all connected vertices
27
Q

How do you perform prims algorithm with a matrix

A
  • Mark stating column one and delete the corresponding row
  • Select value of least weight in starting column and circle - write this value on the side
  • Write 2 on the column corresponding to your chosen value and delete this row
  • Now look down both columns and chose the least value -write this down
  • Write 3 on new column and delete the row
  • Repeat until all rows deleted
28
Q

what are Kruskal’s and prim’s a algorithms used for

A

to find the MST

29
Q

what is dijkstra’s algorithm used for

A

to find shortest distance between 2 points

30
Q

How do you perform dijkstra’s algorithm

A
  • Start at given node
    • Look t all routes out and write down the distance from the origin to each one in the working values box
    • chose the node with the smallest working value and write down 2 in the order box and the distance in the top right box
    • Now look at all routes out of the 2nd node, write down the distance to that node + the distance in the top right of the 2nd nodes box in the new nodes working values
    • Now chose next smallest working value and write 3 on it
      Continue until all boxes filled
31
Q

how do you find the route in dijkstra’s algorithm

A

Start at end with the shortest distance
Go along each arc and subtract the weight from the shortest distance if that equals the distance top right then it is part of the route
Continue until at start

32
Q

what is dijkstra’s algorithm complexity

A

O(n2)

33
Q
  • The maximum flow through a network =
A

the minimum cut

34
Q

First fit is only +

A