0% found this document useful (0 votes)
97 views

Week 9 Assignment

This summary provides the high level information about the document. The document contains 10 multiple choice questions about graph algorithms including Dijkstra's algorithm, BFS, DFS, detecting negative weight cycles and their time complexities. The questions cover topics like finding shortest paths, order of vertex visitation and time complexities of algorithms.

Uploaded by

shreyash
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
97 views

Week 9 Assignment

This summary provides the high level information about the document. The document contains 10 multiple choice questions about graph algorithms including Dijkstra's algorithm, BFS, DFS, detecting negative weight cycles and their time complexities. The questions cover topics like finding shortest paths, order of vertex visitation and time complexities of algorithms.

Uploaded by

shreyash
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

WEEK 9 - Assignment

1. Applying Dijkstra’s algorithm on the following figure,what is the order in which vertices will be
visited? (Use source vertex B.)

A) BDCAEF

B) BDCFAE

C) BDCAFE

D) BDFCAE

2. In the following figure, the shortest path from A to C is along the edges AB,BC. Find the smallest
positive integer from the given options that can be added to all edge weights of the graph such that
it will change the shortest path from A to C

A) 7

B) 6

C) 3

D) 4
3. What is the time complexity of Graph Traversal for DFS and BFS?

A) O(V+E) for BFS and DFS

B) O(V+E) for DFS,O(V) for BFS

C) O(V+E) for BFS,O(log E) for DFS

D) O(E) for BFS,O(V) for DFS

4. In the following figure, which one of the following options gives a negative weight cycle?

A) BAFDACB

B) BACB

C) BAFDCB

D) BADCB

5. The time complexity of Dijkstra’s algorithm while using array as the data structure is:

A) O(1)

B) O(log V)

C) O(log E)

D)O(V2)
6. Consider the given figure and find out which will be the first three vertices traversed by BFS and
DFS, respectively. Take A as starting point.
A) BFS-ABC,DFS-ABC or ADG

B)BFS-ABD,DFS-ABC or ADG

C) BFS-ABC, DFS-ABD or ACG

D) BFS-ABG,DFS-ABD or ACG

7. Which of the following algorithms can be used to detect negative weight cycles in a directed
graph?

A) Bellman Ford

B) Prim's

C) Kruskal's

D) Dijkstra's

8. Apply Dijkstra's Algorithm on the following figure and write down the order in which vertices will be
visited starting from vertex A.

A) ABCDEF

B) ABDCEF

C) ACBDEF

D) ABDEFC

9. Using the same figure of question 8, what is the shortest distance from A to each of B,C,D,E,F
respectively?

A) 4 8 6 7 13

B) 4 6 8 7 10

C) 4 8 9 7 10

D) 4 7 6 8 10

10. Dijkstra's Algorithm is used to:

A) Detect negative weight cycles

B) Find the Minimum Spanning Trees


C) Find Single Source shortest paths

D) Find shortest path between all pairs of vertices


.

You might also like