0% found this document useful (0 votes)
26 views14 pages

Dsu Microproject

circular queue microproject for reference

Uploaded by

jgaikwad737
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views14 pages

Dsu Microproject

circular queue microproject for reference

Uploaded by

jgaikwad737
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

Rajgad Dnyanpeeth Technical Campus Polytechnic, Dhangawadi

Tal. Bhor, Dist. Pune – 412206 (M.S) India

A MICRO PROJECT REPORT


On
“Develop microproject on circular queue ’’

Is Submitted by -
Miss. Gaikwad Pranjal Nilesh
Miss. Jadhav Shweta Pradip
Mr. Kochale Himesh Santosh
Mr. Shrike Aayush Ganapat
Under the guidance of

Prof. Khopade P.S

Subject: - Data Structure Using C


In partial fulfilment of

Diploma in S.Y Computer Engineering


(Academic Year 2024-2025)
Maharashtra State Board of Technical Education, Mumbai
Certificate

This is to certify that following students

Miss. Gaikwad Pranjal Nilesh


Miss. Jadhav Shweta Pradip
Mr. Kochale Himesh Santosh
Mr. Shirke Aayush Ganapat

Has successfully submitted their micro project report on “Develop


microproject on circular queue ’’during the academic year 2024-2025 in the
partial fulfilment towards the completion of micro project in S.Y. Computer
Engineering under MSBTE MUMBAI

Project Guide Head of Department

Prof.Khopade P.S Prof. Khutwad S. S


ACKNOWLEDGEMENT

I am personally indebted to a number of people who gave me their useful insights to


aid in my overall progress for this project. A complete acknowledgement would therefore be
encyclopedic. First of all, I would like to give my deepest gratitude to my parents for
permitting me to take up this course.

My heartfelt sense of gratitude goes to our respected Principal Prof. Khopade D. K.


for all his efforts and administration in educating us in his premiere institution. I take this
opportunity to also thank our Head of the Department, Prof. Khutwad S.S. for her
encouragement throughout the seminar.

I would like to express my sincere thanks and gratitude to my guide Prof. Khopade
P.S for her commendable support and encouragement for the completion of Project with
perfection. I also convey my sincere thanks to Prof. Khutwad S.S for her invaluable
suggestions and for his technical support rendered during the course of my project.
I would like to thank all faculty members and staff of the Department of Computer
Engineering for their generous help in various ways for the guidance of this project.

STUDENT NAME ENROLLMENT NO SIGN

1.Gaikwad Pranjal Nilesh 23213160127

2.Jadhav Shweta Pradip 23213160128

3.Kochale Himesh Santosh 23213160130

4.Shirke Aayush Ganapat 23213160120


ABSTRACT

This microproject involves the Introduction to Circular Queues: A circular queue, also known
as a “Ring Buffer,” takes the ordinary queue and adds a delightful twist: the last element is
connected back to the first, forming a graceful circle. Imagine a queue that wraps around like a
hula hoop, allowing elements to re-enter from the beginning. Here are the key points:

1. What Is a Circular Queue?


o A circular queue extends the concept of a normal queue.
o In a circular queue, the last element is connected to the first, creating a circular
structure.
o Elements follow the FIFO (First In, First Out) principle.

o When the queue becomes full, new elements wrap around to the beginning.

2. Operations on Circular Queues:


o Front: Retrieve the front item from the queue.
o Rear: Retrieve the last item from the queue.
o enQueue (value): Insert an element into the circular queue. The new element
always goes to the rear position.
o deQueue (): Delete an element from the front of the queue.
o Circular queues elegantly solve the major limitation of normal queues by
allowing wraparound behavior.

3. Implementation:
o Circular queues can be implemented using two primary data structures:
 Array: Initialize an array of size n, where n represents the maximum
number of elements the queue can hold.
 Linked List: Create a circular linked list.
o In the array-based implementation:
 Initialize two pointers: front and rear.
 Enqueue: Increment rear, wrap around if needed, and insert.
 Dequeue: Increment front, wrap around if needed, and remove.

INTRODUCTION

Welcome to our Program of forming a circular queue, where we embark on a journey to unravel
the operations and implementation of circular queue using the powerful C programming
language. In this micro project, we aim to guide you through the creation of a sophisticated,
program that showcases the circular queue.

Prepare to dive deep into the forming of circular queue programming as we explore the
intricacies of circular queue. This hands-on experience will not only sharpen your skills in C
programming but also enhance your understanding of data structural concepts behind circular
queue.

Our circular queue program approach will empower you to build an interactive program capable
of handling various data structures and delivering accurate formations of data structures. From
user input validation to the implementation of structural algorithms, we'll cover it all, ensuring
you emerge from this program with a comprehensive skill set.

Join us on this exciting journey as we unlock the secrets of circular queue through the lens of C
programming. By the end of this micro project, you'll be equipped with the knowledge and
confidence to tackle complex data structures. Let's embark on this coding odyssey together and
transform formation of circular queue into an art .
CIRCULAR QUEUE DIAGRMATIC REPRESENTATION
APPLICATION OF CIRCULAR QUEUE

Memory Management:
o Circular queues optimize memory utilization by reusing vacated space.
o Unlike linear queues, where memory can be wasted due to fixed front and rear positions,
circular queues efficiently utilize available memory.
o In memory management systems, circular queues help manage memory allocation and
deallocation efficiently.

Process Scheduling:
o Operating systems use circular queues to manage processes in the CPU scheduler.
o Processes are enqueued and dequeued based on their priority or time slice, ensuring fair
execution.

Traffic Systems:
o Circular queues play a crucial role in computer-controlled traffic systems.
o They are used to switch traffic lights one by one repeatedly as per the predefined time
intervals.
o By cycling through the lights in a circular manner, traffic flow is managed efficiently

Real-Time Systems:
o In real-time systems (e.g., embedded systems, robotics), circular queues buffer sensor
data or control signals.
o Circular buffers ensure smooth data flow and prevent data loss.
o Networking Protocols:
o Circular queues are used for packet buffering and flow control in networking protocols.
o They help manage incoming and outgoing packets efficiently.

1.
NEED OF CIRCULAR QUEUE:-

Memory Utilization:

 Circular queues optimize memory usage by reusing vacated space.


 Unlike linear queues, where memory can be wasted due to fixed front and rear positions,
circular queues efficiently utilize available memory.

Efficient Buffering:

 Circular queues are commonly used for buffering data.


 For example, in real-time systems, circular queues can buffer incoming data or transfer
elements between threads efficiently.

Resource Allocation:

 Circular queues are helpful when managing resource allocation.


 They allow processes or tasks to be queued and executed in a circular manner.

Applications:

 Operating systems use circular queues to manage process execution.


 Circular buffers in audio processing ensure smooth playback and recording.
ADVANTAGES AND DISADVANTAGES OF CIRCULAR QUEUE

Advantages of Circular Queues:

Memory Utilization:

 Circular queues optimize memory usage by reusing vacated space.

 Unlike linear queues, where memory can be wasted due to fixed front and rear positions,
circular queues efficiently utilize available memory.

No Overflow Until Full:

 Circular queues prevent overflow until the queue is genuinely full.

 This maximizes space utilization and avoids unnecessary restrictions.

Disadvantages of Circular Queues:

Complex Implementation:

 Implementing circular queues can be more complex due to wrap-around logic.

 Properly managing the circular nature (e.g., incrementing front and rear pointers)
requires careful handling.
SOURCE CODE
##include <stdio.h>

// Define the maximum size of the queue


#define MAX_SIZE 5

// Declare the queue array and front, rear variables


int queue[MAX_SIZE];
int front = -1, rear = -1;

// Function to check if the queue is full


int isFull() {
return (rear + 1) % MAX_SIZE == front;
}

// Function to check if the queue is empty


int isEmpty() {
return front == -1;
}

// Function to enqueue (insert) an element


void enqueue(int data) {
if (isFull()) {
printf("Queue overflow! Can't add more elements.\n");
return;
}

if (front == -1) {
front = 0; // Set the front to the first position
}

rear = (rear + 1) % MAX_SIZE; // Move the rear pointer


queue[rear] = data; // Insert the new element
printf("Element %d inserted.\n", data);
}

// Function to dequeue (remove) an element


int dequeue() {
if (isEmpty()) {
printf("Queue underflow! Nothing to dequeue.\n");
return -1;
}

int data = queue[front]; // Get the data from the front


if (front == rear) {
front = rear = -1; // Reset pointers if only one element
} else {
front = (front + 1) % MAX_SIZE; // Move the front pointer

}
return data;
}

// Function to display the queue elements


void display() {
if (isEmpty()) {
printf("Queue is empty!\n");
return;
}

printf("Queue elements: ");


int i = front;
while (i != rear) {
printf("%d ", queue[i]);
i = (i + 1) % MAX_SIZE;
}
printf("%d\n", queue[rear]); // Print the last element
}

// Main function
int main() {
enqueue(10);
enqueue(20);
enqueue(30);

display();

int dequeued = dequeue();


if (dequeued != -1) {
printf("Dequeued element: %d\n", dequeued);
}

display();

return 0;
}
OUTPUT

Element 10 inserted
Element 20 inserted
Element 30 inserted
Queue elements: 10 20 30
Dequeued element: 10
Queue elements: 20 30
CONCLUSION

The microproject on the program in C for forming a circular queue has successfully demonstrated the
practical implementation through an intuitive user interface. Through careful design and efficient coding,
the project has achieved the following key outcomes:

 Efficient space utilization: Circular queues are a type of queue that can be used to efficiently
use space. This is because the rear pointer can wrap around to the front of the queue when the
end of the array is reached. This prevents unused space from being left behind, unlike in a linear
queue.

 Ring-like structure: Circular queues have a ring-like structure where the queue end is connected
to the queue start.

 Queue operations: The queue operations in circular queues are similar to basic queues.

 Implementation: Circular queues can be implemented using an array or a circular linked list.

 Time complexity: The time complexity for each queue operation is O(1).

 Uses: Circular queues can be used in areas such as operating systems, networking, and
scheduling systems.

In conclusion, the queue data structure is a linear type of data structure that is used to store the elements.
In this data structure elements are stored in the FIFO technique. A queue data structure used an array or
linked list during its implementation. The program for forming circular queue in C has successfully
combined practical functionality with user-friendly design. The project not only accomplishes its primary
goal of forming circular queue resolution but also serves as an educational resource for programming
enthusiasts. Future enhancements could explore additional data structure, optimization strategies, and
potential integration with other programming paradigms. Overall, this microproject serves as a solid
foundation for those seeking to understand and implement data structures through a program in C.
REFERENCES

Certainly! Here are some reference links that you can explore for your micro project on a
program in C for forming circular queue:

1. *GeeksforGeeks*: C Program to Implement Circular Queue

 This article provides a detailed explanation of circular queues and an array-based


implementation in C. It covers basic operations like enqueue, dequeue, and more.
 Reference link:- C Program to Implement Circular Queue - GeeksforGeeks

2. *Simplilearn*: Circular Queue in Data Structure

 Simplilearn offers an overview of circular queues, their implementation using arrays, and
the core concepts behind them.
 Reference link:- simplilearn.com/tutorials/data-structure-tutorial/circular-queue-in-data-
structure

3. *PrepInsta*: Circular Queue in C

 PrepInsta provides a concise explanation of circular queues along with a C program for
array-based implementation.
 Explore the tutorial
 Reference link:-Circular Queue in C Programming | PrepInsta

4. *Programiz*: Circular Queue Data Structure

 Programiz covers circular queues, their representation, and basic operations. It includes
code snippets for better understanding.
 Reference link:- Circular Queue Data Structure (programiz.com)

These references cover a range of topics, including C programming fundamentals, circular queue
program examples, and their operations in C. They should provide you with a solid foundation
and examples to guide you through the development of your micro project.

You might also like