CSCE4110 Final Flashcards

1
Q

Advantages of adjacency list

A

works well for sparse graphs

space is theta(V + E)

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

disadvantage of adjacency list

A

searching for edges slower than adjacency matrix

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

advantages of adjacency matrix

A

works well for dense graph

edge lookup is theta(1)

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

disadvantage of adjacency matrix

A

requires more space than adjacency list

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

Examples of a BFS algorithm

A

Prims and dijkstras

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

Goal for a BFS algorithm

A

find smallest number of edges to each reachable vertex

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

time complexity for BFS

A

O(V+E)

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

Explain BFS briefly

A

Pick a starting vertex
Visit all nodes connected to starting vertex (start alphabetically)
Mark visited node
Add visited node to Queue

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

Explain DFS briefly

A

Pick a starting vertex
Visit next connected node (alphabetically)
Mark visited node
Add node to top of stack

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

Time complexity of DFS

A

O(V+E)

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

Are MST always unique

A

NO

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

How are Prim’s and Kruskal’s algorithms greedy?

A

Adds smallest weighted edge each step as long as it maintains tree property

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

Time complexity of Kruskals and Prims algorithm

A

O(E lg V)

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

How is single-source shortest paths exhibit optimal substructure?

A

If we have a path p(xy) and patch a new path in between it would be impossible

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

Can shortest paths be computed with negative weight edges?

A

Yes

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

Can shortest paths be computed with negative edge cycle?

A

No

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

Can a shortest path have a cycle?

18
Q

Initialize single source

3 steps

A

Set distance: infinity
Set predecessors: NULL
Set s.d: 0

19
Q

Running time of initializing single source

20
Q

Running time for bellman ford

21
Q

Running time for Dijkstras

22
Q

All pair shortest path input and output

23
Q

Max Flow equilibrium

A

inflow = outflow at every vertex

24
Q

Max flow termination

A

all paths from s to t are blocked by either full forward edge or empty backward edge

25
applications for maxflow
data mining and baseball elimination
26
Rounding errors can increase over series of computations
numerical stability
27
What is a hamiltonian cycle
a simple cycle in a graph G=(V,E) that contains each vertex in V
28
Hamiltonian cycles are generally not solvable in
polynomial time
29
You can check hamiltonian cycles in
polynomial time
30
what are P problems
problems that are solvable in polynomial time
31
what are NP problems
problems that are verifiable in polynomial time
32
if there exists a polynomial-time computable function
the problem is polynomial time reducible
33
what is an approximation ratio
δ if and only if for every instance of the problem, A, gives a solution which is at most δ times the optimal value for that instance
34
δ is always at least
1
35
Why do we use approximation algorithms
used to find approximate solutions to optimization problems
36
traverse traveling sales man graph in
preorder (dot to the left)
37
applications for linear programming
data mining, and supply-chain management
38
what is a slack variable
variable that is added to an inequality constraint to transform it to an equality
39
Feasible solution properties
Set n – m nonbasic variables to 0, solve for remaining m variables. Solve m equations in m unknowns.
40
Where are feasible solutions located on the graph
On the line
41
Decision problems are simply
any problem | whose answer is one bit: “yes” or “no”
42
T/F: The superscripts in an output matrix for an all-pairs shortest paths algorithm refer to the dimensions of the matrix.
True