© 2014 Firstsoft Technologies (P) Limited. login
Hi 'Guest'
Home SiteMap Contact Us Disclaimer
enggedu
Quick Links
Easy Studies

Home Lab Exercise Data Structures Lab Exercise Programs Implementation Of Circular Queue Using Array▼

Implementation of Circular Queue Using Array:

Definition:

 An implementation of a bounded queue using an array.

  (or)

In circular queue, the insertion of a new element is performed at the very first location of the queue if the last location of the queue is full, in which the first element comes  just after the last element.

 Advantages :

 It overcomes the problem of unutilized space in leaner queues, when it is  implemented as arrays.
 
 Insertion :

           Rear = (rear+1)%Maxsize

Alogarithm Steps:

Step 1: create and set the variables front,rear,MAXSIZE,cq[]

step 2: Read the circular queue opeartion type.

step 3: If  operation type is Insertion below steps are executed.

  1. Assign rear=rear%MAXSIZE.
  2. if front equal to (rear+1)%MAXSIZE then display queue is    overflow.
  3. if front equal to -1 then assign front=rear=0.
  4. Otherwise assign rear=(rear+1)%MAXSIZE and read queue data .
  5. Assign cq[rear] as data.(i.e. cq[rear]=data).

step 4: If operation type is Deletion below steps are executed.

  1. Check front=-1 then display queue is underflow.
  2. Set temp as cq[front] (i.e. temp=ca[front]).
  3. Check front equal to rear if it is true then assign front=rear=-1(Move the    front to begining)

  4. Assign front=(front+1)%MAXSIZE.

C Program To Implement Circular Queue Using Array

CPP Program To Implement Circular Queue Using Array

 
SLogix Student Projects

⇓Student Projects⇓
⇑Student Projects⇑
bottom