Brodcasting

#include<stdio.h>
#include<conio.h>
int a[10][10],n;
main()
{
    int i,j,root;
    printf("enter number of nodes \t");
    scanf("%d",&n);
    printf("enter adjacency matrix \t");
    for(i=1;i<=n;i++)
    for(j=1;j<=n;j++)
    {
        printf("enter connectivity of %d to %d is \n ",i,j);
        scanf("%d",&a[i][j]);
    }
    printf("enter root node");
    scanf("%d",&root);
    adj(root);
}
adj(int k)
{
    int i,j;
    printf("\n adjacent nodes of the root of node %d is \n",k);
    for(i=1;i<=n;i++)
    if(a[k][i]==1||a[i][k]==1)
    printf("%d\t",i);
    printf("the remaining nodes \n");
    for(i=1;i<=n;i++)
    if((a[k][i]==0)&&(k!=i))
    printf("%d",i);
}

No comments:

My Favorite Books

  • C and Data Structures by Ashok N. kamthane
  • Web Technologies by A. A. Puntambekar
  • Learn HTML and CSS with W3Schools
  • Learn JavaScript and Ajax with W3Schools
  • HTML5 Black Book: Covers Css3, Javascript,XML, XHTML, Ajax, PHP And Jquery
  • HTML5 Application Development Fundamentals: MTA Exam 98-375
  • .NET 4.0 Programming 6-In-1, Black Book
  • SQL Server 2008 R2 Black Book
  • Asp.net 4.0 Projects Covers: net 3.5 And .net 4.0 Codes, Black Book
  • UNIX Shell Programming 1 Edition by Yashavant Kanetkar
  • UNIX and Shell Programming 1 Edition by Richard F. Gilberg, Behrouz A. Forouzan
  • Computer Networks by Andrew S. Tanenbaum
  • Multiple Choice questions in computer science by Timothy J Williams