100% found this document useful (1 vote)
2K views

Micro Project of Data Structure Using C++ - 3rd SEM - CO

A Project Report on "PERFORMING VAIROUS OPERATIONS ON CIRCULAR QUEUE". Thus, it is useful for Diploma students.

Uploaded by

Tanvi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
2K views

Micro Project of Data Structure Using C++ - 3rd SEM - CO

A Project Report on "PERFORMING VAIROUS OPERATIONS ON CIRCULAR QUEUE". Thus, it is useful for Diploma students.

Uploaded by

Tanvi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION.

GOVERNMENT POLYTECNIC VIKRAMGAD.


MICRO PROJECT.
Academic year 2021-2022

Title of Project
PERFORMING VAIROUS OPERATIONS ON
CIRCULAR QUEUE.

Program Code: Data Structure Using ‘C’.

Semester: Third Semester

Course Code: 22317

Guided by: Prof. Sushil Gawde.

: Group Details:

Sr.no Name of student Roll no. Enrollment no.


1. Gayatri patil 2117 2015470070
2. Sayli Patil 2120 2015470073
3. Tanvi patil 2123 2015470076
4. Swapnil chavan 2147 2115470159
5. Sanket patil 2154 2115470154

1
MAHARASHTRA STATE BOARD OF TECHNICAL
EDUCATION.
CERTIFICATE
This is to certify that Mr./Mrs._________________________________________

Roll No.___________of Third Semester of Diploma in Computer Engineering of


institution, GOVERNMENT POLYTECHNIC VIKRAMGAD (Code:1547) has completed
the Micro project satisfactorily in Subject Data Structure using ‘C’(22317)for the
Academic year 2021-2022 as prescribed in the curriculum.

Place: Enrollment No:

Date: Exam No. seat:

Subject teacher Head of the Department Principal

Seal of

Institution

2
WEEKLY ACTIVITY SHEET:
Institution Code: 1547 Semester: Third Semester

Academic Year: 2021-2022 Program: Computer Engineering

Course and code: Data Structure Using ‘C’ (22317)

Roll no: Exam seat no:

Name of candidate: Name of faculty: - Prof. Sushil Gawde.

SR.NO. WEEK ACTIVITY PERFORRMED DATE SIGN OF


FACULTY
1. 1st Discussion and finalization
of topic
2. 2nd Literature review
3. 3rd Collection of date
4. 4th Collection of date
5. 5th Discussion and outline of
content
6. 6th Formulation of content
7. 7th Editing and proof reading
of content
8. 8th Compilation of report
9. 9th Report presentation
10. 10th Final submission of Micro-
project

3
INDEX

SR.NO. CONTENT PAGE NO.

Introduction of Data Structure, Queue and Circular


1 5
Queue

2 Algorithms 6

3
Program for Performing Operations on Circular Queue 7-9

4 Output Of Program 10-11

5 Conclusion 12

6 Reference 13

4
WHAT IS A DATA STRUCTURE ?

A data structure is a specialized format of organizing and storing the data.

Types of data structure=


1. Primitive data type-
a) Integer
b) Real data type
c) Character
d) String
e) Pointer
2. Non-Primitive data type-
a) Array
b) List
I. Linear
 Stack
 Queue
II. Non-Linear
 Tree
 Graph
c) Files

What is Queue ?
Queue is a linear data structure which follows First-In-First-Out(FIFO) principle where elements
are added at rear end and deleted from the first end.

What is a Circular Queue ?


A queue in which last node is connected back to the first node to form a cycle, is called as
circular queue.

Applications Of Circular Queue:-


 Adding large integers
 Memory management
 Computer controlled traffic system

5
ALGORITHMS

 Algorithm to Implement Circular Queue=


1. FRONT= 1;
2. REAR= 0;
3. COUNT= 0;
4. RETURN;

 Algorithm to Insert /enqueue() an element in Circular Queue=


1. If (((front == 0) and (rear == MAX-1)) or (rear == front-1)
2. Print “Overflow”
3. If(front == -1)
4. Front = rear = 0
5. Else
6. Rear = (rear+1)%MAX
7. Queue[rear] = element

 Algorithm to Delete/dequeue() an element in Circular Queue=


1. If (front == -1)
2. Print “Underflow”
3. Element = QUEUE[front]
4. If (front == rear)
5. Front = rear = -1
6. Else
7. Front = (front+1)%MAX

 Algorithm to check queue is Empty or not=


1. If (COUNT = 0) then;
2. EMPTY= true;
3. Else
4. EMPTY= false;
5. Return;

 Algorithm to check queue is Full or not=


1. If (COUNT = MAX) then;
2. FULL= true;
3. Else
4. FULL= false;
5. Return;

6
PROGRAM
//Program to perform various operations on Circular Queue

#include<stdio.h>
#include<conio.h>
#include<string.h>
#define max 3
int a[max],item,front=-1,rear=-1; //initializing circular queue
void insert();
void delete();
void display();
void main()
{
int choice;
char ch='y';
clrscr();
printf("\n**********OPERATIONS ON CIRCULAR
QUEUE**********\n");
do
{
printf("\n1:Insert\n");
printf("\n2:Delete\n");
printf("\n3:Display\n");
printf("\n4:Exit\n");
printf("\nEnter your choice:-\n");
scanf("\n%d",&choice);
switch(choice)
{
case 1:insert();
break;
case 2:delete();
break;
case 3:display();
break;
case 4:exit();
default:printf("\nYou entered wrong choice");
}
printf("\nDo you want to continue(Y|N):-\n");
scanf("%s",&ch);
}while(ch=='y'||ch=='Y');

7
getch();
}
void insert()
{
if(front==rear+1)
{
printf("\nQueue is full!!!\n");
return;
}
else
{
printf("\nEnter the element:-\n");
scanf("%d",&item);
if(front==-1)
front=rear=0;
else
rear=(rear+1)%max;
a[rear]=item;
}
printf("\n After insertion position of Front=%d and
Rear=%d\n",front,rear);
}
void delete()
{
if(front== -1)
{
printf("\nQueue is empty!!!\n");
return;
}
else
{
item=a[front];
printf("\nThe deleted element is:-%d\n",item);
if(front==rear)
front=rear=-1;
else
front=(front+1)%max;
}
printf("\n After Deletion position of Front=%d and
Rear=%d\n",front,rear);

8
}
void display()
{
int i;
if(front==-1)
{
printf("\nQueue is empty!!!\n");
return;
}
else
{
printf("\nElement in Queue are:\n");
for(i=front;i<=rear;i++)
printf("%d\t",a[i]);
}
if(front>rear)
{
for(i=front;i<max;i++)
printf("%d\t",a[i]);
for(i=0;i<=rear;i++)
printf("%d\t",a[i]);
}
} //End of program

9
OUTPUT:-

10
11
CONCLUSION:-
The purpose behind making this micro-project is to being interact with Circular Queue,
which is a subtype of Queue(A Linear Data Structure). With the proper guidance of professor
and taking reference from textbooks and some websites, we had learn how to implement the
basic operations like Insertion, Deletion, Is_Full, Is_Empty, Front & Rear of Queue on Circular
Queue with the help of ‘C’ programming language.

And we had successfully implemented the program of various operations on circular


queue.

12
REFERENCE:-
www.google.com.in
www.geeksforgeeks.org
www.programiz.com
www.includehelp.com
www.studytonight.com

13

You might also like