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

However, if the list is initially not empty, then the list is traversed to reach the<br />

last element, and then then the element is inserted as the last element of the<br />

list<br />

Algorithm<br />

INSERT_LAST(START, ITEM).This algo inserts an item at the last of the linked<br />

list.<br />

<strong>1.</strong> [Check for overflow ?]<br />

if PTR=NULL, then<br />

print, ‘over flow’<br />

exit<br />

else<br />

PTR=(Node *)malloc (size of (node));<br />

END if<br />

2. Set PTRInfo=Item<br />

3. Set PTRNext=NULL<br />

4. If START=NULL and If then set START=p;<br />

5. Set LOC=start<br />

6. Repeat step 7 untill Lonext!=NULL<br />

7. Set Loc=lonext<br />

8. Set Lonext=p<br />

Prepared By :­<br />

Er. Harvinder Singh<br />

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

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

Saved successfully!

Ooh no, something went wrong!