+ Reply to Thread
Results 1 to 2 of 2

Thread: Check connectivity

  1. #1
    TopGun Guest

    Check connectivity

    You have N computers and [Ca, Cb] means a is connected to b and this connectivity is symmetric and transitive. then write a program which checks that all computers are interconnected and talk two each other

  2. #2
    puspendra Guest
    char array[n][n] = {0};


    for all point [ca,cb]
    array[ca][cb]=1

    tmpQ=emty;
    tmpQ.enque(1);
    ConnectedNode[N]=0;

    ConnectedNode[1]=1;

    while(!tmpQ.empty)
    {
    int node=tmpQ.dequque();
    for(int i=0;i<n;i++)
    if( array[node][i]==1)
    {
    ConnectedNode[i]=1;
    tmpQ.enque(i);
    }
    }

    for(int i=0;i<n;i++)
    if( ConnectedNode[i] == 0)
    return false;

    return true;

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Check validity of char sequence
    By Surfer in forum Amazon
    Replies: 2
    Last Post: 2nd July 2010, 03:04
  2. Check path sum
    By Surfer in forum Amazon
    Replies: 1
    Last Post: 29th May 2010, 13:40
  3. Check Similarity of Trees
    By TopGun in forum Algorithm/Data Structure Questions
    Replies: 1
    Last Post: 6th June 2008, 15:32

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts