queue data structure

what is queue

A queue is a linear structure implement in FIFO(first In first out) manner where insertions can occur only at the “rear” end and deletions can occur only at the “front” end.

OR

 It  is  linear data structure used to represent the linear list and permits  deletion to be performed  at one end of the  list called the  “front of the queue” and the insertions at the other end is called “rear of the queue”.

It is  also called “FIFO” system and “FCFS”

FIFO = first in  first out

FCFO = first come first service

There are three types of operations can be applied into a queue

1 insert   

inserts item  at the rear of the queue.  adds a thing to the queue . on the off chance that the line is full, at that point it is said to be a flood condition.

2  remove

deletes item to the front  element of the queue. expels a thing from the queue. The thing are flown in a similar request in which they are pushed. On the off chance that the queue is unfilled, at that point it is said to be an undercurrent condition.

3 display

the  third operation empty à  return true  or false depending on whether or not the queue contains  any   element.  show all components without erasure.

 

Describe the similarities and differences between Queues and Stacks.

Similarities:-

1. Both queues and stacks are special cases of linear lists.

2. Both can be implemented as arrays or Linked lists.

Differences :-

1. A stack is a LIFO list, A queue is a FIFO list.

2. There are no variations of stack, a que, however, may be circular or deque.

Variations in Queues :-

It can be used in several forms and ways, depending upon the requirements of the program. There are two popular variatins of queues :-

Circulation Queues

Dequeues Queues