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 />

The address of a particular element in a one‐dimensional array is given by the<br />

relation:<br />

Address of element a[k] = {Base address} + {Size of each element in array} *<br />

{Index of the array}<br />

Let LA be a linear array in the memory of the computer.Recall that the memory<br />

of the computer is simply a sequence of addressed locations as picturised in<br />

fig.let us use the notation<br />

LOC(LA[k])=address of the element LA[K] of the array LA<br />

1000<br />

1001<br />

1002<br />

1003<br />

1004<br />

(a) computer memory<br />

As previously noted,the elements of LA are stored in successive memory<br />

cells.Accordingly,thecomputer does not need to keep track of the address of<br />

every elements of LA,but needs to keep track only of the address of the first<br />

element of LA,denoted by<br />

Base(LA)<br />

and called the base address of LA.Using the address Base(LA),the computer<br />

calculates the address of any elements of LA by the following formula:<br />

Prepared By :­<br />

Er. Harvinder Singh<br />

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

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

Saved successfully!

Ooh no, something went wrong!