Professional Documents
Culture Documents
Question 1
0.0/1.0 point (ungraded)
Select all paths which are Eulerian paths in the graph below.
ACBAB correct
ABACB correct
BABCA
CBABAC
CBAB
incorrect
Let me explain:
An Eulerian path visits all edges exactly once. The first two paths hold this condition.
The BABCA path does not exist in the given graph, because there are no edges from
B to C and from C to A. In the CBABAC path, the edge BA is visited twice. In the
CBAB path, not all the edges of the graph are visited, the edge AC is missing
Question 2
Bookmark this page
Question 2
0.0/1.0 point (ungraded)
Select all paths which are Hamiltonian paths in the graph below.
ACBAB
ACB correct
ABC
CBA correct
BAC correct
ACBA
incorrect
Let me explain:
A Hamiltonian path visits all vertices exactly once. The ACB, CBA and BAC paths
hold this condition. The ABC path does not exist in the given graph, because there is
no edge from B to C. In the ACBAB and ACBA paths, vertices B and/or A are visited
more than once.
Question 3
Bookmark this page
Question 3
1.0/1.0 point (ungraded)
What is the running time of the breadth first search algorithm?
Question 4
Bookmark this page
Question 4
1.0/1.0 point (ungraded)
What kind of Dijkstra implementation is the most efficient one for dense graphs?
Naive implementation (iterates over all vertices to find the vertex with the smallest
distance) correct
Binary heap implementation
Fibonacci heap implementation
Let me explain:
In a dense graph, |E| is about |V|2, so the running time of the binary heap
implementation would be O(E log|V|) = O(|V|2 log|V|). The running time of the naive
implementation is O(|V|2), which is better in this case. The Fibonacci heap
implementation yields O(V log |V| + |E|) = O(V log |V| + |V|2) time and is usually
impractical
Question 5
Bookmark this page
Question 5
1.0/1.0 point (ungraded)
What is the running time of the Floyd-Warshall algorithm?
O(V E log|V|)
O(|V|2)
O(|V|3) correct
Let me explain:
Recall that there are three nested cycles over all vertices in the Floyd-Warshall
algorithm, so its running time is cubic in the number of vertices.