Question: C++ The file UnGraph.cpp contains the code for defining an undirected graph . Use this file to write a program to create a minimum spanning

C++

The file UnGraph.cpp contains the code for defining an undirected graph. Use this file to write a program to create a minimum spanning tree according the Kruskal algorithm. Print the tree. Then, find those couple of vertices, among which are the edges with the minimum and the maximum value (weight). Print those vertices and the weight of the edges between them, and then check whether there is a path between those vertices in the minimum spanning tree.

The file UnGraph.cpp

Example output:

#include

#include

#include

using namespace std;

int main() {

string input;

stack s;

queue q;

cout

cin >> input;

for (int i = 0; i

if (islower(input[i])) {

s.push(input[i]);

}

else {

q.push(input[i]);

}

}

cout

while (!s.empty()) {

cout ";

s.pop();

}

cout

cout

while (!q.empty()) {

cout ";

q.pop();

}

cout

while (!s.empty()) {

q.push(s.top());

s.pop();

}

cout

cout

cout

while (!q.empty()) {

cout ";

q.pop();

}

cout

return 0;

}

Example Output :

C++ The file UnGraph.cpp contains the code for defining an undirected graph.

The graph g

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!