Automata Data Structure OS Graph Theory Microprocessor: Tutorials
Automata Data Structure OS Graph Theory Microprocessor: Tutorials
Academic Tutorials
Automata
Data Structure
OS
Graph Theory
Microprocessor
Cryptography
Compiler Design
Computer Graphics
IPv4
Parallel Algorithm
Database Concept
DBMS
SQL
SQLite
Programming
Tutorials
C
C++
JAVA
C#
Python
Programs
C
C++
JAVA
Python
Preparation
Syllabus
Gate
Interview
Technical
HR/PI
Gk/Aptitude
http://scanftree.com/Data_Structure/circular-queue 1/12
9/15/2017 Circular Queues
Gk
Aptitude
MCQ
C
JAVA
Networking
Miscellaneous
Calculator
Health
Math
Developers
Css/Html Maker
Cheat Sheets
SEO Tools
Other
Math Formulas
IFSC Codes
Search
Data Structure
Introduction
Linked List
Circular Linked List allows addition of data at the end of the queue and removal of data at the beginning
of the queue. Circular queues have a fixed size.
Stack Circular queue follows FIFO principle. Queue items are added at the rear end and the
items are deleted at front end of the circular queue.
Queues
Queues
Static Queues
Dynamic Queues
» Circular Queues
http://scanftree.com/Data_Structure/circular-queue 2/12
9/15/2017 Circular Queues
Double-ended
Queue
Recursion
Searching
Sorting Algorithms
Algorithms
Tree
Algorithm for Insertion in a circular queue
Interview Question
Insert CircularQueue ( )
2. Print: Overflow
3. Else
6. Set REAR = 1
7. Else
http://scanftree.com/Data_Structure/circular-queue 3/12
9/15/2017 Circular Queues
11. Exit
#include<stdio.h>
#include<string.h>
#include<conio.h>
#include<ctype.h>
#include<stdlib.h>
#define size 8
int no;
int q[size];
int rear=-1;
int front=-1;
void Insert_queue()
char ans;
http://scanftree.com/Data_Structure/circular-queue 4/12
9/15/2017 Circular Queues
ans=getch();
while(ans!='n')
scanf("%d",&no);
return;
else if(rear==front-1)
return;
http://scanftree.com/Data_Structure/circular-queue 5/12
9/15/2017 Circular Queues
front=0;
rear=0;
q[rear]=no;
else if(rear==size-1)
rear=0;
q[rear]=no;
else
rear++;
if(rear==front)
return;
else
q[rear]=no;
http://scanftree.com/Data_Structure/circular-queue 6/12
9/15/2017 Circular Queues
ans = getch();
void Display_queue()
int i;
if(front < 0)
return;
printf("\nItems are:\n");
if(rear>=front)
http://scanftree.com/Data_Structure/circular-queue 7/12
9/15/2017 Circular Queues
else
for(i=0;i<=rear;i++)
/* Function main */
void main()
clrscr();
Insert_queue();
Display_queue();
getch();
http://scanftree.com/Data_Structure/circular-queue 8/12
9/15/2017 Circular Queues
Delete CircularQueue ( )
2. Print: Underflow
3. Else
4. ITEM = QUEUE[FRONT]
7. Set FRONT = 1
http://scanftree.com/Data_Structure/circular-queue 9/12
9/15/2017 Circular Queues
8. Else
11. Exit
void Delete_queue()
if(front < 0)
return;
no=q[front];
q[front]=NULL;
if(front==rear)
http://scanftree.com/Data_Structure/circular-queue 10/12
9/15/2017 Circular Queues
front=-1;
rear=-1;
else if(front==size-1)
front=0;
else
front++;
Next →
Quantitative Aptitude
Arithmetic DI
Reasoning
Logical Verbal
Nonverbal
Programming
http://scanftree.com/Data_Structure/circular-queue 11/12
9/15/2017 Circular Queues
Interview
HR Technical Interview
http://scanftree.com/Data_Structure/circular-queue 12/12