formatting source-code for 153fb7b8a5

This commit is contained in:
github-actions
2020-05-30 04:02:09 +00:00
parent 92fe9495ec
commit 8a2de9842b
175 changed files with 1671 additions and 3460 deletions

View File

@@ -9,8 +9,7 @@ typedef std::pair<int, int> PII;
bool marked[MAX];
std::vector<PII> adj[MAX];
int prim(int x)
{
int prim(int x) {
// priority queue to maintain edges with respect to weights
std::priority_queue<PII, std::vector<PII>, std::greater<PII> > Q;
int y;
@@ -18,8 +17,7 @@ int prim(int x)
PII p;
Q.push(std::make_pair(0, x));
while (!Q.empty())
{
while (!Q.empty()) {
// Select the edge with minimum weight
p = Q.top();
Q.pop();
@@ -29,8 +27,7 @@ int prim(int x)
continue;
minimumCost += p.first;
marked[x] = true;
for (int i = 0; i < adj[x].size(); ++i)
{
for (int i = 0; i < adj[x].size(); ++i) {
y = adj[x][i].second;
if (marked[y] == false)
Q.push(adj[x][i]);
@@ -39,8 +36,7 @@ int prim(int x)
return minimumCost;
}
int main()
{
int main() {
int nodes, edges, x, y;
int weight, minimumCost;
@@ -49,8 +45,7 @@ int main()
return 0;
// Edges with their nodes & weight
for (int i = 0; i < edges; ++i)
{
for (int i = 0; i < edges; ++i) {
std::cin >> x >> y >> weight;
adj[x].push_back(std::make_pair(weight, y));
adj[y].push_back(std::make_pair(weight, x));