answersLogoWhite

0

AllQ&AStudy Guides
Best answer

// transpose for the sparse matrix void main() { clrscr(); int a[10][10],b[10][10]; int m,n,p,q,t,col; int i,j; printf("enter the no of row and columns :\n"); scanf("%d %d",&m,&n); // assigning the value of matrix for(i=1;i<=m;i++) { for(j=1;j<=n;j++) { printf("a[%d][%d]= ",i,j); scanf("%d",&a[i][j]); } } printf("\n\n"); //displaying the matrix printf("\n\nThe matrix is :\n\n"); for(i=1;i<=m;i++) { for(j=1;j<=n;j++) { printf("%d\t",a[i][j]); } printf("\n"); } t=0; printf("\n\nthe non zero value matrix are :\n\n"); for(i=1;i<=m;i++) { for(j=1;j<=n;j++) { // accepting only non zero value if(a[i][j]!=0) { t=t+1; b[t][1]=i; b[t][2]=j; b[t][3]=a[i][j]; } } } printf("a[0 %d %d %d\n",m,n,t); for(i=1;i<=t;i++) { printf("a[%d %d %d %d\n",i,b[i][1],b[i][2],b[i][3]); } a[0][1]=n; a[0][2]=m; a[0][3]=t; int s[10],u[10]; if(t>0) { for(i=1;i<=n;i++) { s[i]=0; } for(i=1;i<=t;i++) { s[b[i][2]]=s[b[i][2]]+1; } u[1]=1; for(i=2;i<=n;i++) { u[i]=u[i-1]+s[i-1]; } for(i=1;i<=t;i++) { j=u[b[i][2]]; a[j][1]=b[i][2]; a[j][2]=b[i][1]; a[j][3]=b[i][3]; u[b[i][2]]=j+1; } } printf("\n\n the fast transpose matrix \n\n"); printf("a[0 %d %d %d\n",n,m,t); for(i=1;i<=t;i++) { printf("a[%d %d %d %d\n",i,a[i][1],a[i][2],a[i][3]); } getch(); }

This answer is:
Related answers

// transpose for the sparse matrix void main() { clrscr(); int a[10][10],b[10][10]; int m,n,p,q,t,col; int i,j; printf("enter the no of row and columns :\n"); scanf("%d %d",&m,&n); // assigning the value of matrix for(i=1;i<=m;i++) { for(j=1;j<=n;j++) { printf("a[%d][%d]= ",i,j); scanf("%d",&a[i][j]); } } printf("\n\n"); //displaying the matrix printf("\n\nThe matrix is :\n\n"); for(i=1;i<=m;i++) { for(j=1;j<=n;j++) { printf("%d\t",a[i][j]); } printf("\n"); } t=0; printf("\n\nthe non zero value matrix are :\n\n"); for(i=1;i<=m;i++) { for(j=1;j<=n;j++) { // accepting only non zero value if(a[i][j]!=0) { t=t+1; b[t][1]=i; b[t][2]=j; b[t][3]=a[i][j]; } } } printf("a[0 %d %d %d\n",m,n,t); for(i=1;i<=t;i++) { printf("a[%d %d %d %d\n",i,b[i][1],b[i][2],b[i][3]); } a[0][1]=n; a[0][2]=m; a[0][3]=t; int s[10],u[10]; if(t>0) { for(i=1;i<=n;i++) { s[i]=0; } for(i=1;i<=t;i++) { s[b[i][2]]=s[b[i][2]]+1; } u[1]=1; for(i=2;i<=n;i++) { u[i]=u[i-1]+s[i-1]; } for(i=1;i<=t;i++) { j=u[b[i][2]]; a[j][1]=b[i][2]; a[j][2]=b[i][1]; a[j][3]=b[i][3]; u[b[i][2]]=j+1; } } printf("\n\n the fast transpose matrix \n\n"); printf("a[0 %d %d %d\n",n,m,t); for(i=1;i<=t;i++) { printf("a[%d %d %d %d\n",i,a[i][1],a[i][2],a[i][3]); } getch(); }

View page

Find an unscrambler.

View page

Ndsi stands for N d s i

i u c n

n a r t

t l e e

e e r

n n n

d e

o t

/

I standing for 'eye' as in camera.

View page

An arithmetic sequence is usually given by a formula in which the nth term, T(n), is given in terms of the first term, a, and the common difference, d:

t(n) = a + d*(n-1) where n= 1, 2, 3, etc

An alternative is to define it iteratively. Thus:

t1 = a

tn = tn-1 + d , where n = 2, 3, 4, etc

View page

L-I-N-D-O or B-O-N-I-T-O (masculine) L-I-N-D-A or B-O-N-I-T-A (feminine)

View page
Featured study guide
📓
See all Study Guides
✍️
Create a Study Guide
Search results