Queues |
|
|
A queue is a linear list of elements in which deletions can take place only at one end, called the front of the stack, and insertion can take place only at the other end, called the rear. The term FRONT and REAR are used in describing a linear list only when it is implanted as queue. Queues are also called First in First out (FIFO) Lists.
Add an Item Into Queue:
procedure additem (item : items);
{add item to the queue q}
begin
if rear=n then OverFlow
else begin
rear :=rear+1;
q[rear]:=item;
end;
end;{of additem }
Deletion from Queue:
procedure deleteitem (item : items);
{delete from the front of q and put into item}
begin
if front = rear then UnderFlow
else begin
front := front+1
item := q[front];
end;
end; {of deleteitem }
Static and Dynamic Lists
A static data structure is a data structure created for an input data set which is not supposed to change within the scope of the problem. When a single element is to be added or deleted, the update of a static data structure incurs significant costs, often comparable with the construction of the data structure from scratch. In real applications, dynamic data structures are used, which allow for efficient updates when data elements are inserted or deleted.
|
|
|