Final Exam Flashcards

1
Q

Suppose the compressed adjacency list representation is used for a directed graph with n vertices and m edges.
a) What is the value stored at the last entry of the tailTab?
b) What is the number of entries in the two tables?
c) What is the last subscript for the tailTab?

A

a) m
b) n + 1 and m
c) n

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

What is the expected number of probes for an unsuccessful search in hashing by chaining when there:
a) are 2000 items stored in a structure with 100 linked lists?
b) are 1000 items stored in a structure with 100 linked lists?

A

a) 20
b) 10

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

What is the expected number of probes for a successful search in hashing by chaining with α as the load factor?

A

α/2

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

The capacity of the following cut is ____. (S vertices are bold.)
S ->(5) A ->(4) B ->(3) C ->(2) D ->(1) T

A

9

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

Suppose a depth-first search on a directed graph yields a path of tree edges from vertex X to vertex Y and a path of tree edges from vertex X to Z. If there is also an edge from Y to X, then what type will it be?
a) back
b) cross
c) forward
d) tree

A

Back

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

Suppose a depth-first search on a directed graph yields a path of tree edges from vertex X to vertex Y and a path of tree edges from vertex X to Z. If there is also an edge from Y to Z, then what type will it be?
a) back
b) cross
c) forward
d) tree

A

Cross

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

Which of the following cannot occur when additional edges are included in a directed graph?
a) the number of strong components may remain the same
b) the number of strong components may increase
c) the number of strong components may decrease
d) the graph acquires a cycle

A

The number of strong components may increase.

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

For a double hash table with:
a) α = 0.9
b) α = 0.75
c) α = 0.8
(without deletions), the upper bound on the expected number of probes for unsuccessful search is:

A

a) 10
b) 4
c) 5
( 1/ 1-α)

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

What is required when calling union(i, j) for maintaining disjoint subsets?

A

i and j are leaders for different subsets

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

Suppose a directed graph has a path from vertex X to vertex Y, but no path from vertex Y to vertex X. The relationship between the finish times for depth-first search is:

A

finish(X) > finish(Y)

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

The cycle property for minimum spanning trees may be used to find an MST by:

A

Remove the maximum weight edge in any cycle until only a tree of edges remain.

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

What is the number of strongly connected components in this graph?

A

Understand strongly connected components
(includes a picture)

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

Which algorithm maintains multiple subtrees?

A

Kruskal’s

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

Which edge is chosen in a phase of Kruskal’s algorithm?

A

A minimum-weight edge that keeps the result free of cycles
(or)
The unprocessed edge (x, y) of smallest weight such that find(x) != find(y)

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

Before searching for a minimum cut in a network, it is useful to do the following:

A

Find and record augmenting paths until none remains.

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

Which person listed below has not won the Turning Award?
a) Dijkstra
b) Goldberg
c) Karp
d) Tarjan

A

Goldberg

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

The worst-case time for Prim’s algorithm implemented with a minheap is:

A

Θ (E log V)

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

The number of edges in a maximum bipartite matching for the graph below is:

A

Understand maximum bipartite
(includes picture)

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

What is the Edmonds-Karp variant?

A

Using BFS to search a residual network for an augmenting path.

20
Q

When using two breadth-first searches to find the diameter of a tree, the purpose of the first search is to find:

A

One end of a diameter

21
Q

Suppose that there is only one path from vertex 5 to vertex 10 in a directed graph:
5 -> 7 -> 4 -> 3 -> 2 -> 10
During the scan of which column will Warshall’s algorithm record the presence of this path?

22
Q

A topological ordering of a directed graph may be computed by:

A

Ordering the vertices by descending finish times after DFS

23
Q

The number of potential probe sequences when using double hashing with a table with m entries (m is prime) is:

24
Q

When finding the strongly connected components, the number of components is indicated by:

A

The number of restarts for the second depth-first search
(or)
The number of times the vertex color table is scanned during the second depth-first search

25
Q

In Dijkstra’s algorithm, the final shortest path distance from the source s to a vertex x is known when:

A

x has its entry extracted from the heap

26
Q

For which graph representation is querying for the presence of an edge supported by binary search?

A

Compressed adjacency lists (ordered)

27
Q

Which disjoint subset implementation implements the find operation in constant time?

A

Implementation 1

28
Q

Suppose a depth-first search on a directed graph yields a path of tree edges from vertex X to vertex Y and a path of tree edges from vertex X to Z. If there is also an edge from Z to X, then what type will it be?

29
Q

Suppose an instance of bipartite matching has 4 vertices in the left column, 8 vertices in the right column, and
a) 20 edges.
b) 17 edges.
The number of edges in the corresponding instance of network flow is:

A

a) 32
b) 29

30
Q

The relationship of the net flow across a cut and the amount of flow from the source to the sink is?

A

They are equal

31
Q

The capacity of the following cut is ____. (S vertices are bold.)
S ->(4) A ->(10) B ->(3) C ->(1) D ->(5) T

32
Q

During a breadth-first search, the status of a white vertex is:

A

It is undiscovered

33
Q

During depth-first search on an undirected graph, a cycle is indicated by which edge type?

34
Q

The worst-case time for the memoryless version of Dijkstra’s algorithm is?

35
Q

The capacity of any cut is:

A

An upper bound on the maximum flow.

36
Q

During a breadth-first search, the status of a gray vertex is:

A

It is in the FIFO queue

37
Q

Suppose that there is only one path from vertex 7 to vertex 5 in a directed graph:
7 -> 4 -> 1 -> 6 -> 3 -> 8 -> 2 -> 5.
During the scan of which column will Warshall’s algorithm record the presence of this path?

38
Q

Suppose an instance of bipartite matching has 5 vertices in the left column, 8 vertices in the right column, and 17 edges. The number of edges in the corresponding instance of network flow is:

39
Q

The capacity of the following cut is ____. (S vertices are bold.)
S ->(5) A ->(4) B ->(10) C ->(3) D ->(1) T

40
Q

The worst-case time for Dijkstra’s algorithm implemented with a minheap is:

A

θ (E log V)

41
Q

Path compression is part of which disjoint subset implementation?

A

Implementation 3

42
Q

The capacity of the following cut is ____. (S vertices are bold.)
S ->(1) A ->(4) B ->(5) C ->(3) D ->(10) T

43
Q

Using the values never-used (-1) and recycled (-2) are part of which data structure?

A

Open Addressing

44
Q

When a graph is dense, the best way to find a minimum spanning tree is:

A

Prim’s algorithm using T-table

45
Q

Dijkstra’a algorithm may be viewed as being a generalization of which technique?