answersLogoWhite

0


Best Answer

Technically that's a statement, not a question, but check this out

http://en.wikipedia.org/wiki/Circular_buffer

Basically, any operating system uses these for loading files into. The basic idea is that you have a fixed chunk of memory to work with.

User Avatar

Wiki User

12y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

11y ago

#include <stdio.h>

#include<ctype.h>

# define MAXSIZE 200

int cq[MAXSIZE];

int front,rear;

void main()

{

void add(int,int [],int,int,int);

int del(int [],int ,int ,int );

int will=1,i,num;

front = 1;

rear = 1;

clrscr();

printf("

Program for Circular Queue demonstration through array

");

while(will ==1)

{

printf("

MAIN MENU:

1.Add element to Circular Queue

2.Delete element from the Circular Queue

");

scanf("%d",&will);

switch(will)

{

case 1:

printf("

Enter the data... ");

scanf("%d",&num);

add(num,cq,MAXSIZE,front,rear);

break;

case 2: i=del(cq,MAXSIZE,front,rear);

printf("

Value returned from delete function is %d ",i);

break;

default: printf("

Invalid Choice . ");

}

printf("

Do you want to do more operations on Circular Queue ( 1 for yes, any other key to exit) ");

scanf("%d" , &will);

} //end of outer while

} //end of main

void add(int item,int q[],int MAX,int front,int rear)

{

rear++;

rear= (rear%MAX);

if(front ==rear)

{

printf("

CIRCULAR QUEUE FULL

");

return;

}

else

{

cq[rear]=item;

printf("

Rear = %d Front = %d ",rear,front);

}

}

int del(int q[],int MAX,int front,int rear)

{

int a;

if(front == rear)

{

printf("

CIRCULAR STACK EMPTY

");

return (0);

}

else

{

front++;

front = front%MAX;

a=cq[front];

return(a);

printf("

Rear = %d Front = %d ",rear,front);

}

}

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Real time example of circular queue?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Real time example for double ended queue?

glass tumler


What is the difference between linear and circular queue?

What is the difference between linear and circular queue? In: http://wiki.answers.com/Q/FAQ/2545-37 [Edit categories]The Queue by Default is Linear, it would be termed as Circular if the Last Element of the Queue pointsto the first element of the List


What is the definition of circular queue?

A queue is simply a FIFO i.e first in first out. In queue we've front and rear. Front is the initial or first location of the queue whereas rear indicates the last entry location in the queue. In the circular queue the location of front and rear will be the same IF the total space of the circular queue is utilized. Each element has its position no. for insertion , if we set the 5th element as the front element then after every insertion the ptr indicates the 5th element as front. in deletion, the fifth element is deleted every time it is the rear position. after deletion of an element the queue rotates and every time the rear indicates the 5th element of the circular queue. and every time the 5th location element is deleted.


How ordinary queue is solved in circular queue?

An ordinary queue requires constant time access to the first and last elements, because all insertions occur at the back of the queue and all extractions at the front. Thus we require two pointers. However, with a circular queue, the next element after the last element is always the first element, thus we gain constant-time access to both the front and back of the queue through a single pointer to the back of the queue.


Circular queue in linear data structure?

The queue is a linear data structure where operations of insertion and deletion are performed at separate ends also known as front and rear. Queue is a FIFO structure that is first in first out. A circular queue is similar to the normal queue with the difference that queue is circular queue ; that is pointer rear can point to beginning of the queue when it reaches at the end of the queue. Advantage of this type of queue is that empty location let due to deletion of elements using front pointer can again be filled using rear pointer.

Related questions

Real time example for double ended queue?

glass tumler


Give atleast 5 real life examples of circular queue?

Application of queue- 1. Task waiting for line printer 2.Time sharing by CPU 3.access to disk storage.. I am not able to find out any application of circular queue..It would be great if anybody help me out


What is the difference between linear and circular queue?

What is the difference between linear and circular queue? In: http://wiki.answers.com/Q/FAQ/2545-37 [Edit categories]The Queue by Default is Linear, it would be termed as Circular if the Last Element of the Queue pointsto the first element of the List


What is definition of circular queue?

A queue is simply a FIFO i.e first in first out. In queue we've front and rear. Front is the initial or first location of the queue whereas rear indicates the last entry location in the queue. In the circular queue the location of front and rear will be the same IF the total space of the circular queue is utilized. Each element has its position no. for insertion , if we set the 5th element as the front element then after every insertion the ptr indicates the 5th element as front. in deletion, the fifth element is deleted every time it is the rear position. after deletion of an element the queue rotates and every time the rear indicates the 5th element of the circular queue. and every time the 5th location element is deleted.


What is the definition of circular queue?

A queue is simply a FIFO i.e first in first out. In queue we've front and rear. Front is the initial or first location of the queue whereas rear indicates the last entry location in the queue. In the circular queue the location of front and rear will be the same IF the total space of the circular queue is utilized. Each element has its position no. for insertion , if we set the 5th element as the front element then after every insertion the ptr indicates the 5th element as front. in deletion, the fifth element is deleted every time it is the rear position. after deletion of an element the queue rotates and every time the rear indicates the 5th element of the circular queue. and every time the 5th location element is deleted.


How ordinary queue is solved in circular queue?

An ordinary queue requires constant time access to the first and last elements, because all insertions occur at the back of the queue and all extractions at the front. Thus we require two pointers. However, with a circular queue, the next element after the last element is always the first element, thus we gain constant-time access to both the front and back of the queue through a single pointer to the back of the queue.


Circular queue in linear data structure?

The queue is a linear data structure where operations of insertion and deletion are performed at separate ends also known as front and rear. Queue is a FIFO structure that is first in first out. A circular queue is similar to the normal queue with the difference that queue is circular queue ; that is pointer rear can point to beginning of the queue when it reaches at the end of the queue. Advantage of this type of queue is that empty location let due to deletion of elements using front pointer can again be filled using rear pointer.


How do you write a Java program to implement weighted queue using circular doubly linked list?

Add weights to the elements of the queue and use an algorithm to sort the queue every time an element is added.


What is the advantage of circular queue over simple queue?

Circular queue have less memory consuption as compared to linear queue because while doing insertion after deletion operation it allocate an extra space the first remaining vacant but in circular queue the first is used as it comes immediate after the last.


Example of round robin?

The round robin scheduling algorithm works by placing all processes in a circular queue and allotting each process a single time slice until all processes are completed. If process A required 2 time slices, process B required 1 time slice, and process C required 3 time slices the queue would be as follows: A &gt; B &gt; C &gt; A &gt; C &gt; C.


What kind of data structure is required to implement the round-robin scheduling?

cicular queue :D if you want to implement the round robin you need the data structure of circular queue so that when we give the time quantum for the processes then if that process is complete in that time period then its ok but if not then we have to put that process in the queue so that all other processes are also get the time to execute i.e. to remove starvation


What are the Advantages and disadvantages of a queue?

The advantage of multilevel queue scheduling is that it covers all disadvantage of all others scheduling...................... The main disadvantage of multilevel queue scheduling is that it is very difficult to understand and it takes a lot of time........ By waqar ahmad awan (0333-9996376)