10.09.2013 Views

1. Advanced Data Structure using C++

1. Advanced Data Structure using C++

1. Advanced Data Structure using C++

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

LECTURE NOTES OF ADVANCED DATA STRUCTURE (MT-CSE 110)<br />

corresponding row numbers of each nonzero element, aij, in<br />

matrix A.<br />

• JA, an integer array of (at least) length ne contains the<br />

corresponding column numbers of each nonzero element, aij,<br />

in matrix A.<br />

Consider the following as an example of a 6 by 6 sparse matrix A and<br />

how it can be stored in arrays AR, IA, and JA.:<br />

Given the following matrix A:<br />

┌ ┐<br />

| 11 0 13 0 0 0 |<br />

| 21 22 0 24 0 0 |<br />

| 0 32 33 0 35 0 |<br />

| 0 0 43 44 0 46 |<br />

| 0 0 0 0 0 0 |<br />

| 61 62 0 0 65 66|<br />

└ ┘<br />

the arrays are:<br />

AR = (11, 22, 32, 33, 13, 21, 43, 24, 66, 46, 35, 62, 61, 65, 44)<br />

IA = (1, 2, 3, 3, 1, 2, 4, 2, 6, 4, 3, 6, 6, 6, 4)<br />

JA = (1, 2, 2, 3, 3, 1, 3, 4, 6, 6, 5, 2, 1, 5, 4)<br />

AR(k) = aij<br />

IA(k) = i<br />

JA(k) = j<br />

where:<br />

aij are the elements of the m by n sparse matrix A.<br />

Arrays AR, IA, and JA each have ne elements.<br />

4. Storage‐by‐Columns<br />

Prepared By :­<br />

Er. Harvinder Singh<br />

Assist Prof., CSE, H.C.T.M (Kaithal) Page ‐ 130 ‐

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!