Answer:
Yep thats how it works!
a linear equation determines a line in the xy plane
The algorithm is given below.
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;
const int MAX = 1e4 + 5;
int id[MAX], nodes, edges;
pair <long long, pair<int, int> > p[MAX];
void initialize()
{
for(int i = 0;i < MAX;++i)
id[i] = i;
}
int root(int x)
while(id[x] != x)
id[x] = id[id[x]];
x = id[x];
return x;
void union1(int x, int y)
int p = root(x);
int q = root(y);
id[p] = id[q];
long long kruskal(pair<long long, pair<int, int> > p[])
int x, y;
long long cost, minimumCost = 0;
for(int i = 0;i < edges;++i)
// Selecting edges one by one in increasing order from the beginning
x = p[i].second.first;
y = p[i].second.second;
cost = p[i].first;
// Check if the selected edge is creating a cycle or not
if(root(x) != root(y))
minimumCost += cost;
union1(x, y);
return minimumCost;
int main()
long long weight, cost, minimumCost;
initialize();
cin >> nodes >> edges;
cin >> x >> y >> weight;
p[i] = make_pair(weight, make_pair(x, y));
// Sort the edges in the ascending order
sort(p, p + edges);
minimumCost = kruskal(p);
cout << minimumCost << endl;
return 0;
,,,,,,,,,,,,,,,,,,,,......................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
Step-by-step explanation:
;-;
10.25 gallons
432 miles / 6 gallons=72 miles to gallon
738 miles / 72 miles per gallon=10.25 gallons
Sovle for I and go step by step and how your teacher has showed you i dont know how your teacher has showed you
6 and 9
set up an equation and solve for x
(x+3) * x = 54
easiest way to to try some numbers.
if you know your multiplication tables...
what two number multiplied together are 54
be sure the numbers you are thinking of meet the rules
is one 3 more than the other
do they multiply together to get 54