DSU Microproject
DSU Microproject
“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.”
DIPLOMA ENGINEERING
In
Computer Engineering
BY:-
1. Swayam Habbu
2. Sham Gyanbote
3. Mujammil Mulla
4. Vishal Yadav
5. Sanskar Dongare
1
CERTIFICATE
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
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.
268
Sham Gyanbote
Name &
Signature of Name: Signature:
faculty
3
ACKNOWLEDGEMENT
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.
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;
}
}
}
rear = temp;
}
count++;
}
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-Data-Structure
Linked list can be visualized as a chain of nodes, where every node points to
the next node.
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 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 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.
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()
# Connect nodes
linked_list.head.next = second
second.next = third