by Anonymous on January 26th, 2008

Anonymous

Question

Help answer this question below.

How do I implement queue, circular queue, priority queue with C programming?

Answers. 3 helpful answers below.

  • by Stableboy on January 26th, 2008

    Stableboy

    On Answerbag, your inquiry needs to be in the form of a question.

    If you're asking us to write implementations of all these queues for you, you can probably forget it -- but we can provide helpful tips if you struggle with the problem yourself first and ask specific questions.

    No comments. Post one | Permalink

  • by vikgupta07 on December 18th, 2009

    vikgupta07

    queue is a linear ds where the data transfer takes place both at rear end and front ends.
    types:
    1.simple queue:
    insertion from rear end
    deletion from front end

    //insertion in simple queue

    void insert(int queue[],int ele)
    {
    if(rear==size-1)
    {
    printf("queue is fill");
    }
    else
    if(rear==-1)
    {
    rear=front=0;
    queue[rear]=ele;
    }
    else
    rear=rear+1;
    queue[rear]=ele;
    }

    int delete(int queue[])
    {
    if(front==-1)
    {
    printf("the queue is empty");
    return(0);
    }
    elseif(front==rear)
    {
    front=rear=-1;
    ele=queue[front]'
    }
    else
    {
    ele=queue[front];
    front=front+1;
    return(ele);
    }

    similarly use % for circular queues

    vikram gupta
    itm

    No comments. Post one | Permalink

  • by Gaurav on August 1st, 2009

    Gaurav

    what is acutal use of queue in c++ programming Also where can we use this ?

    No comments. Post one | Permalink

Did this answer your question? If not, then ask a new question or create a poll.

You're reading How do I implement queue, circular queue, priority queue with C programming?

Related Ads