Tags » MST

DVD Review 'MST3K Volume 30': Straight Talk

I know: MST3K box set reviews tend to drone. There’s often little room for ‘tude while assessing new content, which leads to “This set’s special features include blah blah blah.” 841 more words

MST

Kruskal Algorithm using Union-Find data structure

So , today’s post is based on Kruskal’s algorithm.It is basically meant for finding out the minimum spanning tree(MST) using the greedy approach.

I have used the data structure called disjoint sets in my implementation.You can study it from Cormen,it has been covered really well there :). 558 more words

Data Structure

Down with Capital's FIFA

Down with capital’s FIFA! #NaoVaiTerFinal

Defeat the Popular Front! Down with the union bureaucracy!

No illusions in bourgeois elections!

We will not pay the debt for the World Cup! 2,241 more words

Brazil

The Drug Regime

I have been on my new treatment for 12 days now. Considering I have been through it all before, twice before, it is taking some getting used to. 619 more words

Myeloma

10600 - Uva -ACM Contest and Blackout

#include<iostream>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<cstdio>
#include <set>
#include<queue>
#include<stack>
#include<vector>
#define INF 1000000000
#define MAX 1000000
using namespace std;
int A;
int father(int node )
{
    if(A== node )return node;
    return A=father(A);
}
bool IntheSameset(int a, int b)
{
    return father(a)==father(b);
}
void UnIon(int a ,int b)
{
    A=father(b);
}
class edge
{
public:
    int U,V,C;
    edge() {};
    edge(int a ,int b ,int d)
    {

        U=a;
        V=b;
        C=d;
    }
    bool operator < (const edge & E )const

    {
        return C <= E.C;
    }

};
int F;
edge E;
int main()
{

    int n,a,b,u,v,c;
    scanf("%d",&n);
    while(n--)
    {


        scanf("%d %d",&a,&b);
        int e=0,f=0;
        while(b--)
        {
            scanf("%d %d %d",&u,&v,&c);
            E=(edge(u,v,c));

        }

        for(int i=0; i<=a; i++)A[i]=i;
        sort(E,E+e);

        int MST1=0,MST2=INF,q=0;

        for(int i=0; i<e && q<a-1; i++)
        {
            if(!IntheSameset(E[i].U,E[i].V))
            {
                q++;
                UnIon(E[i].U,E[i].V);
                F=(i);
                MST1+=E[i].C;

            }
        }

        for (int i=0; i<f; i++)
        {
            int  TempMST2=0;
            q=0;
            for(int j=0; j<=a; j++)A[j]=j;

            for (int j=0; j<f; j++)
                if(j!=i)
                {
                        q++;
                        UnIon(E].U,E].V);
                        TempMST2+=E].C;

                }


            for (int j=0; j<e&& q<a-1; j++)
            {

                if(j!=F[i] )
                    if(!IntheSameset(E[j].U,E[j].V))
                    {
                        q++;
                        UnIon(E[j].U,E[j].V);
                        TempMST2+=E[j].C;

                    }

            }

            if(q==a-1)
                MST2=min(MST2,TempMST2);
        }
        printf("%d %d\n",MST1,MST2);
    }
    return 0;
}
Graph

Modern master suppression techniques

Today I was part of the most dysfunctional meeting I have ever attended. I was sitting in as a substitute student representative (boy, don’t I sound important), and therefore it was my first time ever meeting this group of adults. 581 more words

Multi-Angle Therapy

Hey team!

As many of you might know, this summer I’m involved with a child welfare agency in Chicago called Youth Outreach Services.  So far, I have spent a lot of my time designing invitations and brochures and posting web stories to the YOS blog.   335 more words

Favorite