Question: Question 1. Write down the order in which the nodes are visited when running a) BFS, and b) DFS in the following tree (starting from
Question 1. Write down the order in which the nodes are visited when running a) BFS, and b) DFS in the following tree (starting from vertex A). When there are multiple edges, start with the edge with the lowest weight.

Question 2. Consider the recursive implementation of DFS. What would happen if you never set the visited to be true in DFS? Would the algorithm still be correct? Would it terminate? Would your answer change if you marked the visited eld to true *after* you visit all the neighbours? Give example(s) to justify your answer.
Question 3. Starting with vertex A, compute the shortest-path to all the vertices in the graph using Dikstra's algorithm

Question 4. Show that Dikjstra's algorithm no longer works if the graph contains a negative-weight cycle.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
