Monday, March 31, 2008

Saturday, March 29, 2008

Prim Algorithm

/* This is program to solve Graph Using Prim Algorithm */

#include

main()
{
int a[6][6];int s[6];int p[6];
int i,j,k,t=0,ri,rmin,par;


/* User Inputs */
for(i=0;i<6;i++)
for(j=0;j<6;j++)
cin>>a[i][j];


/* Set parent value -1 for all*/
for(i=0;i<6;i++)
p[i]=-1;

s[0]=0;
p[0]=0;

while(t<6){
for(i=0;i<=t;i++)
{
k=s[i];
for(j=0;j<6;j++)
{
rmin=9999;
if(a[k][j]>0)
{

if(a[k][j]
{
ri=j;
rmin=a[k][j];
par=k;

}
}
}

}

a[par][ri]=0;a[ri][par]=0;
p[ri]=par;
t++;
s[t]=ri;

}




p[0]=-1;

/* Display parent list for each node*/
for(i=0;i<6;i++)
cout<

}


you can change its size from 6 to n, using dynamic array, for this you have to first declare pointer with memory int* a=(int*)malloc(n*n*sizeof(int));
and replace a[i][j] with *(a+i*n+j);
declare single dimensial array as int* p=new int[n];



Best Multiplayer Game

There are hundereds of multi-player games for pc in different categories, But there are some which are more popular than other.
Although counterstrike is leading game in action, if we talk about multi-player games, but Call of duty is one i like. Me and my friends used to play Call of duty in our HOSTEL's Wi-Fi Network. And we became addicted to it. The only advantage of playing counter-strike over CoD is that you can play with computer players. But maps of CoD are much better than cs. These maps are larger and with very good graphics. You can make very little changes to games without any tool.