Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
LECTURE NOTES OF ADVANCED DATA STRUCTURE (MT-CSE 110)<br />
on the basis of “FIRST COME FIRST SERVE”. A Queue is a logically first in<br />
first out type<br />
Type of data structure. It is a linear list in which deletions are perform<br />
from the beginning i.e known as front of the list & insertions are performed at<br />
the end i.e known as rear of the list.<br />
The information in such type of list can be processed on the basis of first term<br />
first serve<br />
EXAMPLE Queue at the railway reservation booth<br />
EXPLAINATION<br />
For getting the railway reservation new customers got into the queue<br />
from the rear end whereas the customers who get their seats<br />
reserved they leave from the queue from the front end. It means<br />
customers are service in the order in which they arrive.<br />
Thus, a queue is a non‐primitive linear data structure & can be<br />
defined as the collection of homogeneous elements in which new<br />
elements are added at one end called rear end & the existing<br />
elements are deleted from other end known as front end.<br />
IMPLEMENTATION OF QUEUES<br />
Queues can be implemented in to two different ways:‐<br />
Static implementation.<br />
Dynamic implementation.<br />
<strong>1.</strong>Static implementation: If queue is implemented <strong>using</strong> array we must know<br />
about the adjacent no. of element we want to store in a queue .so at the<br />
beginning of the array we will be sure of the front pointer of the queue & the<br />
rear pointer for the queue.The following formula will give the fol. no. of<br />
elements in the queue<br />
FRONT=REAR+1<br />
OPERATIONS ON QUEUES<br />
Prepared By :<br />
Er. Harvinder Singh<br />
Assist Prof., CSE, H.C.T.M (Kaithal) Page ‐ 139 ‐