Can you give your problem instead of a program? People will have hard time understanding the C Program. It would be better if you can tell what is the problem you are trying to solve.
regards, Arun. On Wed, Dec 17, 2008 at 7:23 AM, sharad kumar <[email protected]>wrote: > > hi, > this is a part of source code for page ranking algo used for search > engine.its similar to RIP and OSPF > o/p:probabilities > > > #include<iostream.h> > #include<conio.h> > #include<algorithms.h> > int main() > { > int adj[10][10],prob1[10][10],prob2[9][9],adj1[9][9]; > int prob,i,j,k,l,c; > cout<<endl; > cout<<"nter dependency matrix"<<endl; > for(i=0;i<10;i++) > { > for(j=0;j<n;j++) > { > cout<<"nter 1 for dependency else 0"; > cin>>k; > if(k) > { > adj[i][j]=1; > c++; > } > else > { > adj[i][j]=0; > continue; > } > } > for(l=0;l<n;l++) > prob1[i][l]=(1/c); > } > for(i=0;i<n;i++) > { > for(j=0;j<n;j++) > { > int max1=prob1[i][j]; > if(prob1[i][j]>max) > max=prob1[i][j]; > else > continue; > } > cout<<"the page for corresponding keyword searched is"; > //for other pages > } > > for(i=1;i<=n;i++) > for(j=1;j<=n;j++) > adj1[i][j]=adj[i][j]; > for(k=0;k<n;k++) > for(i=0;i<n;i++) > for(j=0;j<n;j++) > { > if(prob1[i][j]<=1&&prob1[i][k]+prob1[k][j]<=1) > { > if(prob1[i][j]>prob1[i][k]+prob1[k][j]) > prob2[i][j]=min(prob1[i][j],prob1[i][k]+prob1[k][j]); > adj1[i][j]=adj[i][j]; > } > elseif(prob1[i][j]>1) > { > prob2[i][j]=1; > adj1[i][j]=adj[i][j]; > } > else > { > prob2[i][j]=1; > adj1[i][j]=j; > } > max2=prob2[0][0]; > for(i=0;i<9;i++) > for(j=0;j<9;j++) > max1=max(max2,prob2[i][j]); > cout<<"the page for corresponding keyword searched is"; > //for other pages call this routine recursively; > } > > pls tell any dp solution for it > > > > -- =================================== want to know more about me http"//ww.livejournal.com/users/arunachalam --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/algogeeks -~----------~----~----~----~------~----~------~--~---
