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

Step4. Setting the righ link of the node pointed by prev and the left link of the<br />

node pointed by cur point to the new node. See Figure 3.2.1‐04.<br />

Deletion of Double Linked List:<br />

Deletion is to remove a node from a list. It can also take place anywhere ‐‐ the<br />

first, last, or interior of a linked list.<br />

To delete a node from a double linked is easier than to delete a node from a<br />

linear linked list. For deletion of a node in a single linked list, we have to search<br />

and find the predecessor of the discarded node. But in the double linked list, no<br />

such search is required. Given the address of the node that is to be deleted, the<br />

predecessor and successor nodes are immediately known.<br />

The following example will give the details<br />

Example: Delete a node pointed by old from a double linked list. Assume the list<br />

is not empty.<br />

Step <strong>1.</strong> Setting pointer prev points to the left node of old and pointer cur points<br />

to the node on the right of old. See Figure 3.2.2‐0<strong>1.</strong><br />

Prepared By :­<br />

Er. Harvinder Singh<br />

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

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

Saved successfully!

Ooh no, something went wrong!