how to addres sparse matrix n*n dimension when stored in a single dimensional array.

Recommended Answers

All 6 Replies

Given an array a[M][N] , a[i][j] is logically equivalent to a[i * N + j] if the dimensions are stored in sequence.

no when the sparse matrix is converted to single dimension...

ex..uppertriangular matrix a[0..n-1,0..n-1] is stored in array b[0...1/2(n(n+1))-1] in lexicographical order.

find address of a[80,90] when a[0,0] is stored at b[0]. n=100

no

How is what I said wrong?

when the sparse matrix is converted to single dimension...

If you knew the answer, why did you waste our time in asking? By the way, your original question didn't mention converting a sparse matrix to a single dimensional array. If you had asked how to do the conversion, you would have gotten a better answer.

i knew its wrong as ur ans is simple addressing which is not in dis case.. if u know ans..

i knew its wrong as ur ans is simple addressing which is not in dis case..

You asked about addressing, and my answer was about addressing. If you want a better answer, ask a better question. That's my point, now I'll take my leave of this thread.

if u can't don't regard ques as not better...if u can't ans better not reply

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.