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?

A

No

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

A

theta(V)

20
Q

Running time for bellman ford

A

theta(VE)

21
Q

Running time for Dijkstras

A

O(E lg V)

22
Q

All pair shortest path input and output

A

a matrix

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
Q

applications for maxflow

A

data mining and baseball elimination

26
Q

Rounding errors can increase over series of computations

A

numerical stability

27
Q

What is a hamiltonian cycle

A

a simple cycle in a graph G=(V,E) that contains each vertex in V

28
Q

Hamiltonian cycles are generally not solvable in

A

polynomial time

29
Q

You can check hamiltonian cycles in

A

polynomial time

30
Q

what are P problems

A

problems that are solvable in polynomial time

31
Q

what are NP problems

A

problems that are verifiable in polynomial time

32
Q

if there exists a polynomial-time computable function

A

the problem is polynomial time reducible

33
Q

what is an approximation ratio

A

δ 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
Q

δ is always at least

A

1

35
Q

Why do we use approximation algorithms

A

used to find approximate solutions to optimization problems

36
Q

traverse traveling sales man graph in

A

preorder (dot to the left)

37
Q

applications for linear programming

A

data mining, and supply-chain management

38
Q

what is a slack variable

A

variable that is added to an inequality constraint to transform it to an equality

39
Q

Feasible solution properties

A

Set n – m nonbasic variables to 0, solve for remaining m variables.

Solve m equations in m unknowns.

40
Q

Where are feasible solutions located on the graph

A

On the line

41
Q

Decision problems are simply

A

any problem

whose answer is one bit: “yes” or “no”

42
Q

T/F: The superscripts in an output matrix for an all-pairs shortest paths algorithm refer to the dimensions of the matrix.

A

True