0% found this document useful (0 votes)
8 views19 pages

DSU Microproject

The project report details the development of a C program that implements queue operations using a linked list, allowing for the shifting of a person's position based on priority or removal from the queue. It includes a description of the queue data structure, its FIFO principle, and the implementation of various queue operations such as enqueue, dequeue, and display. The project was completed by a group of students under the guidance of Ms. R.A. Wadikar at Swami Vivekanand Institute of Technology, Solapur, for the Diploma in Computer Engineering.
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)
8 views19 pages

DSU Microproject

The project report details the development of a C program that implements queue operations using a linked list, allowing for the shifting of a person's position based on priority or removal from the queue. It includes a description of the queue data structure, its FIFO principle, and the implementation of various queue operations such as enqueue, dequeue, and display. The project was completed by a group of students under the guidance of Ms. R.A. Wadikar at Swami Vivekanand Institute of Technology, Solapur, for the Diploma in Computer Engineering.
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/ 19

A PROJECT REPORT ON

“Develop a program in C that create to Queue of given person. Shift the original
position of person to new position based on its changed priority or remove a
person from the Queue using Linked List Implementation.”

Submitted in partial fulfilment of the requirements of the award of degree


Of

DIPLOMA ENGINEERING
In

Computer Engineering
BY:-

1. Swayam Habbu
2. Sham Gyanbote
3. Mujammil Mulla
4. Vishal Yadav
5. Sanskar Dongare

UNDER THE GUIDANCE:


Ms. Wadikar R.A.

SWAMI VIVEKANAND INSTITUTE OF TECHNOLOGY(POLY)


SOLAPUR 2023-24

1
CERTIFICATE

The project report entitled “Queue Operation Using Liked List”

Submitted by:
1. Swayam Habbu
2. Sham Gyanbote
3. Mujammil Mulla
4. Vishal Yadav
5. Sanskar Dongare

is approved for the Diploma of Engineering in Computer from Swami Vivekanand Institute
of Technology(Poly),Solapu

Name of Guide Name of H.O.D


(Ms. R.A. Wadikar) (Ms. P.U. Waghamare)
Department of Computer Engineering Department of Computer Engineering.
SVIT COLLEGE ,SOLAPUR SVIT COLLEGE ,SOLAPUR

Examiner Principal
(Prof. ) (Prof.Mr. S.V. Kulkarni)
Place: Solapur
Date:
2
Annexure II
Evolution sheet for Micro Project
Academic Year: - 2023-24 Name of Faculty: Ms. R.A. Wadikar
Course: - Computer Engineering Course code: - CO3I
Scheme: - I Subject Code: -22317
rd
Semester:- 3 Subject: -Data Structure Using C
Title of
Project: - Queue Operation Using Liked List
COs addressed by the Micro Project:
CO3 Implement basic operations on stack and queue using array representation.

CO4 Implement basic operations on Linked List.

Major Learning Outcomes achieved by students by doing the Project:

1. Develop a ‘C’ program to use Queue representation in memory


using array
(a)Practical Outcomes: 2. Develop algorithm to insert the given item in linear linked list.

1. Queue Operations – INSERT, DELETE


(b) Unit Outcomes in 2.Create relevant structure to represent the given node using linked list
Cognitive domain:

1. Deal with attitudes, feelings, and values.


(c) Outcomes in
Affective Domain:

Comments/Suggestions about teamwork/leadership/inter-personal communication (if any)

Marks out Marks out


of 6 for of 4 for
Total marks
Roll No Name of student performan performance in
out of 10
ce in group oral/Presentatio
activity n
204 Swayam Habbu

268
Sham Gyanbote

209 Sanskar Dongare

202 Vishal Yadav


263 Mujammil Mulla

Name &
Signature of Name: Signature:
faculty
3
ACKNOWLEDGEMENT

I take this opportunity to express my sincere thanks and deep sense of


gratitude to my guide, Ms. R.A. Wadikar Madam for her constant support,
motivation, valuable guidance and immense help during the entire course
of this work. Without her constant encouragement, timely advice and
valuable discussion, it would have been difficult in completing this work. I
would also like to acknowledge Computer Engineering department who
provided me the facilities for completion of the project. We are thankful to
her for sharing her experienced in research field with me and providing
constant motivation during entire project work.

Name of Student: -

1. Swayam Habbu
2. Sham Gyanbote
3. Mujammil Mulla
4. Vishal Yadav
5. Sanskar Dongare
We define a queue to be a list in which all additions to the list are made at one end, and
all deletions from the list are made at the other end. The element which is first pushed
into the order, the operation is first performed on that.

Queue Data Structure

FIFO Principle of Queue:


 A Queue is like a line waiting to purchase tickets, where the first person in line is
the first person served. (i.e. First come first serve).
 Position of the entry in a queue ready to be served, that is, the first entry that will
be removed from the queue, is called the front of the queue(sometimes, head of
the queue), similarly, the position of the last entry in the queue, that is, the one
most recently added, is called the rear (or the tail) of the queue. See the below
figure.

Fifo Property in Queue


#include <stdio.h>
#include <stdlib.h>

struct node
{
int info;
struct node *ptr;
}*front,*rear,*temp,*front1;

int frontelement();
void enq(int data);
void deq();
void empty();
void display();
void create();
void queuesize();

int count = 0;

void main()
{
int no, ch, e;

printf("\n 1 - Enque");
printf("\n 2 - Deque");
printf("\n 3 - Front element");
printf("\n 4 - Empty");
printf("\n 5 - Exit");
printf("\n 6 - Display");
printf("\n 7 - Queue size");
create();
while (1)
{
printf("\n Enter choice : ");
scanf("%d", &ch);
switch (ch)
{
case 1:
printf("Enter data : ");
scanf("%d", &no);
enq(no);
break;
case 2:
deq();
break;
case 3:
e = frontelement();
if (e != 0)
printf("Front element : %d", e);
else
printf("\n No front element in Queue as queue is empty");
break;
case 4:
empty();
break;
case 5:
exit(0);
case 6:
display();
break;
case 7:
queuesize();
break;
default:
printf("Wrong choice, Please enter correct choice ");
break;
}
}
}

/* Create an empty queue */


void create()
{
front = rear = NULL;
}

/* Returns queue size */


void queuesize()
{
printf("\n Queue size : %d", count);
}

/* Enqueing the queue */


void enq(int data)
{
if (rear == NULL)
{
rear = (struct node *)malloc(1*sizeof(struct node));
rear->ptr = NULL;
rear->info = data;
front = rear;
}
else
{
temp=(struct node *)malloc(1*sizeof(struct node));
rear->ptr = temp;
temp->info = data;
temp->ptr = NULL;

rear = temp;
}
count++;
}

/* Displaying the queue elements */


void display()
{
front1 = front;

if ((front1 == NULL) && (rear == NULL))


{
printf("Queue is empty");
return;
}
while (front1 != rear)
{
printf("%d ", front1->info);
front1 = front1->ptr;
}
if (front1 == rear)
printf("%d", front1->info);
}

/* Dequeing the queue */


void deq()
{
front1 = front;

if (front1 == NULL)
{
printf("\n Error: Trying to display elements from empty queue");
return;
}
else
if (front1->ptr != NULL)
{
front1 = front1->ptr;
printf("\n Dequed value : %d", front->info);
free(front);
front = front1;
}
else
{
printf("\n Dequed value : %d", front->info);
free(front);
front = NULL;
rear = NULL;
}
count--;
}

Linklist:

linked list is a linear data structure, in which the elements are


not stored at contiguous memory locations. The elements in a
linked list are linked using pointers as shown in the below image:

Linked-List-Data-Structure

In simple words, a linked list consists of nodes where each node


contains a data field and a reference(link) to the next node in the list.
 Singly Linked List − The nodes only point to the address of the next
node in the list.
 Doubly Linked List − The nodes point to the addresses of both
previous and next nodes.
 Circular Linked List − The last node in the list will point to the first
node in the list. It can either be singly linked or doubly linked.
Linked List Representation

Linked list can be visualized as a chain of nodes, where every node points to
the next node.

As per the above illustration, following are the important points to be


considered.

 Linked List contains a link element called first (head).


 Each link carries a data field(s) and a link field called next.
 Each link is linked with its next link using its next link.
 Last link carries a link as null to mark the end of the list.
Types of Linked List

Following are the various types of linked list.

Singly Linked Lists

Singly linked lists contain two “buckets” in one node; one bucket holds the
data and the other bucket holds the address of the next node of the list.
Traversals can be done in one direction only as there is only a single link
between two nodes of the same list.

Doubly Linked Lists

Doubly Linked Lists contain three “buckets” in one node; one bucket holds
the data and the other buckets hold the addresses of the previous and next
nodes in the list. The list is traversed twice as the nodes in the list are
connected to each other from both sides.

Circular Linked Lists

Circular linked lists can exist in both singly linked list and doubly linked list.

Since the last node and the first node of the circular linked list are
connected, the traversal in this linked list will go on forever until it is broken.

Basic Operations in the Linked Lists

The basic operations in the linked lists are insertion, deletion, searching,
display, and deleting an element at a given key. These operations are
performed on Singly Linked Lists as given below −

Program of Linklist:-
class Node:
# Creating a node
def __init__(self, item):
self.item = item
self.next = None

class LinkedList:

def __init__(self):
self.head = None

if __name__ == '__main__':

linked_list = LinkedList()

# Assign item values


linked_list.head = Node(1)
second = Node(2)
third = Node(3)

# Connect nodes
linked_list.head.next = second
second.next = third

# Print the linked list item


while linked_list.head != None:
print(linked_list.head.item, end=" ")
linked_list.head = linked_list.head.next

You might also like