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

Circular Link List<br />

Circular linked list is a linked list in which the last node of the list points to the<br />

first node in the list.<br />

A good example of an application where circular linked list should be used is a<br />

timesharing problem solved by the operating system. In a timesharing<br />

environment, the operating system must maintain a list of present users and<br />

must alternately allow each user to use a small slice of CPU time, one user at a<br />

time. The operating system will pick a user, let him/her use a small amount of<br />

CPU time and then move on to the next user, etc. For this application, there<br />

should be no NIL pointers unless there is absolutely no one requesting CPU<br />

time.<br />

The insert, delete and search operations are similar to the singly linked list. In<br />

circular linked list, we should always maintain that the next node of the tail is<br />

linked to the head after the insertion and deletion operations: Advantages:<br />

Disadvantage:<br />

• Each node is accessible from any node.<br />

• Address of the first node is not needed.<br />

• Certain operations, such as concatenation and splitting of string, is<br />

more efficient with circular linked list.<br />

• Danger of an infinite loop !<br />

Prepared By :­<br />

Er. Harvinder Singh<br />

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

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

Saved successfully!

Ooh no, something went wrong!