Coders Packet

ARRAY IMPLEMENTATION OF QUEUES Using C++

By Srivenurajulu G

  • New Text Document (2).txt
  • arrqueue.cpp
  • array implmentation of queues algo.txt
  • array implmentation of queues.docx
  • ARRAY IMPLEMENTATION OF QUEUES Using rear and front. It is a linear data structure and it follows the first in first out technique. Using C++ Programming Language.

    Definition:

     ARRAY IMPLEMENTATION OF QUEUES Using rear and front.

    ALGORITHM:

    Enqueue

    1. Start
    2. If the stack is empty, then read the data
    3. Increment the rear and store the data in the rear index of q
    4. Stop

    Dequeue 

    1. Start
    2. Set the element to be deleted as q[front]
    3. Increment front
    4. Stop

    Is empty

    1. Start
    2. If the rear is less than the front then return 1
    3. Otherwise, return 0
    4. Stop

    Is full

    1. If the rear is equal to one less than the size then return 1
    2. Otherwise, return 0
    3. Stop

    Display

    1. Start
    2. From front as the first index and rear as the last index print all the elements
    3. Stop

    For Example:

    Enter choice

    Menu...

    1.Insert

    2.Delete

    3.Display

    1

     

    Enter the data   2

     

    Do you want to continue (0/1) 1

     

    Enter choice

    Menu...

    1.Insert

    2.Delete

    3.Display

    1

     

    Enter the data   3

     

    Do you want to continue (0/1) 1

     

    Enter choice

    Menu...

    1.Insert

    2.Delete

    3.Display

    3

     

    Displaying...

    2 3

    Do you want to continue (0/1 )1

     

    Enter choice

    Menu...

    1.Insert

    2.Delete

    3.Display

    2

     

    Displaying...

    3

    Do you want to continue (0/1) 0

    NOTE:

    In a queue, the element is inserted on the rear side and deleted on the front side.

    Download Complete Code

    Comments

    Comments for the packet "ARRAY IMPLEMENTATION OF QUEUES Using C++";
    No comments yet