Page 1 of 1

0 3 1 1 7 3 2 L 5 9 2 4 1 #include #include #define MAX 50 #define N 5 //number of Nodes #define S 0 //starting vertex v

Posted: Tue Jul 05, 2022 10:33 am
by answerhappygod
0 3 1 1 7 3 2 L 5 9 2 4 1 Include Include Define Max 50 Define N 5 Number Of Nodes Define S 0 Starting Vertex V 1
0 3 1 1 7 3 2 L 5 9 2 4 1 Include Include Define Max 50 Define N 5 Number Of Nodes Define S 0 Starting Vertex V 1 (8.73 KiB) Viewed 12 times
0 3 1 1 7 3 2 L 5 9 2 4 1
#include #include #define MAX 50 #define N 5 //number of Nodes #define S 0 //starting vertex void fixMatrix (int adjList [MAX] [MAX]) { for (int i=0; i Weight\n"); printf (" =====\n"); int cost=0; for (int i=0; i %d\n",v1, v2, adjList [v1] [v2]); //c. complete this line to compute total cost of MST (5) printf("============: ==\n"); printf ("Total Cost: %d\n", cost); return 0;
Edges of MST: Edge => Weight 0 3 => 1 0 1 => 3 1 2 => 2 2 4 => 1 Total Cost: 7