b)
i)
To make new copy of reverse graph we require total edges knowledge of original graph
because we are using hash dictionary insertion time is constant
So total time required would O(V + E).
ii)
For storing reverse we need to store details of all vertices and edges through adjacency list
Complexity : O(V+E).
iii)
Instead of appying shortest path algorithm on all edges we just apply it once on Emergency location and we try to maintain parent vertex for path retrieval. So that we can obtain full path route and also shortest distance
iv)
For creating reverse graph O( V + E )
As we are using adjacency list and if we try to use priority queue , Our total runtime would be O ( V + ElogV ) as insertion and searching in priority queue is logV
Total Complexity would be O ( V + E + ElogV )
In this question, we will think about how to answer shortest path problems where we have more than just a single sourc...
In this question, we will think about how to answer shortest path problems where we have more than just a single source and destination. Answer each of the following in English (not code or pseudocode). Each subpart requires at most a few sentences to answer. Answers significantly longer than required will not receive full credit You are in charge of routing ambulances to emergency calls. You have k ambulances in your fleet that are parked at different locations, and you...
Your teacher is going to give a test where each student is to answer one question. None of the neighboring students should have the same question. How many questions are needed? Graph Coloring Algorithm is used to solve this type of problems. It does not guarantee to use the minimum number of questions, but it guarantees an upper bound on the number of questions. The algorithm never uses more than d+1 questions where d is the maximum degree of vertices...