Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

5:37 PM moodle.selu.edu oo AT&T; 3. In one of the little known battles of the Ci

ID: 3588253 • Letter: 5

Question

5:37 PM moodle.selu.edu oo AT&T; 3. In one of the little known battles of the Civil War, General Tecumsch Beauregard lost the Third Battle of Bull Run because his preparations were not complete when the enemy attacked. If the critical path had been available, the general could have planned better Suppose that the following project network with activity times in days had been available. Determine the earliest and the latest start and finish times, activity slack times, critical path, and the time between the gencral's reccipt of battle orders and the onset of battle. Move bidges Create neneering division Ines d Cavalry Devellop plan pacement Cavary eney Troop mach ines eartwods

Explanation / Answer

This can be done using graph data Structure by finding the shortest path between two nodes in a directed and weighted graph.

The code snipet is given below assuming the above structure is represented in a form of a graph[][V](Matrix) u = 1 and v =10 and k = no of edges = 2

int shortestPath(int graph[][V], int u, int v, int k)

{

   // Base cases

   if (k == 0 && u == v)             return 0;

   if (k == 1 && graph[u][v] != INT_MAX) return graph[u][v];

   if (k <= 0)                       return INT_MAX;

   // Initialize result

   int res = INT_MAX;

   // Go to all adjacents of u and recur

   for (int i = 0; i < V; i++)

   {

       if (graph[u][i] != INT_MAX && u != i && v != i)

       {

           int rec_res = shortestPath(graph, i, v, k-1);

           if (rec_res != INF)

              res = min(res, graph[u][i] + rec_res);

       }

   }

   return res;

}

Please let me know if the answer helped.

Thanks.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote