You are on page 1of 18

Shrikrishna Educational and Cultural Mandal’s SHRI

GULABRAO DEOKAR POLYTECHNIC ,


Gat No. 26, Mohadi Shivar, Shirsoli Road
JALGAON – 425002 (M.S.)

A micro project report


On

Develop a project and demonstrate use of link list


Is submitted as per I Scheme Curriculum and the requirement for the

Program: Diploma in Computer Engg.

Course : Data Structure(22317)

Group Members :

49. VAIBHAV RAJU KOLI. ( )


50. YASH DHANRAJ THAKUR. ( )
51. PATEL ANAS JAHANGEER. ( )
52. SAYYED MOHAMMD RAYYAN SAJID ALI. ( )

Guided by

MINAKSHI YEOLE

Affiliated to
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION,
MUMBAI – 51
Academic year : 2023-2024
1
MAHARASHTRA STATE BOARD OF TECHNIC AL EDUCATION,
MUMBAI – 51

CERTIFICATE
This is to certify that Mr. / Ms __________________________________________________________________________
Roll No:____________ of First Semester Of Diploma in _________________________ Engg of Institute SHRI
GULABRAO DEOKAR POLYTECHNIC, JALGAON ( Institute Code : (0509) has completed the micro
project satisfactorily in the Subject:- DATA STRUCTURE (22317) for the academic year 2023 to 2024
as prescribed in the curriculum.

Place : Jalgaon Enrollment no______________

Date:_____________ Exam Seat no_______________

Subject Teacher Head of Department


Signature Signature

2
Annexure-I
A MICRO PROJECT ON Demonstrate use of link list

0.1 Brief Introduction


Diploma engineers (also called technologists) have to deal with various
materials and machines. This course is designed with some fundamental
information to help technologists apply the basic concepts and principles of
Technology to solve broad-based engineering problems.

0.2 Proposed methodology


To Prepare a report on Describe.

0.3 Resources used


Sr. no. Name of resource material Specifications Quantity

1. Asus Tuf A15 32GB RAM, Windows 11 1

2. Internet Google / Wikipedia -

3. Textbook/manual DSU (22317) 1

3
0.4 Action Plan
Plan Plan
Name of responsible team
Sr.no Detail of activity Start Finish
members
Date Date
49. VAIBHAV RAJU KOLI
50. THAKUR YASH DHANRAJ
Searching the topic for 21/08/23 31/08/23
1.
micro-project

Collect information 49. VAIBHAV RAJU KOLI


2. from the internet and 01/09/23 15/09/23 50. THAKUR YASH DHANRAJ
textbook

49. VAIBHAV RAJU KOLI


Collect information
50. THAKUR YASH DHANRAJ
from the DSU(22317)
3. 16/09/23 30/09/23
reference book, and
debugged the errors.

49. VAIBHAV RAJU KOLI


Arrange all information 50. THAKUR YASH DHANRAJ
4. 02/10/23 16/10/23
in MS word

49. VAIBHAV RAJU KOLI


Prepare a report on it 50. THAKUR YASH DHANRAJ
5. 17/10/23 23/10/23
using MS word

51. PATEL ANAS JAHANGEER


52. SAYYED MOHAMMD RAYYAN SAJID ALI
6. Print micro project 24/10/23 27/10/23

4
5
Index

Sr.no. TopIcS page no.

1) Information about link list 7


2) Types of linked list 8-9
3) Flow Chart 10
4) Algorithm 11
5) Program 11-16
6) Output 17

What is a Linked List?


• A linked list is a linear data structure that stores a collection of data elements dynamically.

• Nodes represent those data elements, and links or pointers connect each node.

• Each node consists of two fields, the information stored in a linked list and a pointer that
stores the address of its next node.

• The last node contains null in its second field because it will point to no node.

6
• A linked list can grow and shrink its size, as per the requirement.

• It does not waste memory space.

Representation of a Linked List


This representation of a linked list depicts that each node consists of two fields. The first field consists
of data, and the second field consists of pointers that point to another node.

Here, the start pointer stores the address of the first node, and at the end, there is a null pointer that
states the end of the Linked List.

Types of Linked Lists

Singly Linked List


A singly linked list is the most common type of linked list. Each node has data and an address field that
contains a reference to the next node.

7
Doubly Linked List
There are two pointer storage blocks in the doubly linked list. The first pointer block in each node
stores the address of the previous node. Hence, in the doubly linked inventory, there are three fields
that are the previous pointers, that contain a reference to the previous node. Then there is the data, and
last you have the next pointer, which points to the next node. Thus, you can go in both directions
(backward and forward).

Circular Linked List


The circular linked list is extremely similar to the singly linked list. The only difference is that the last
node is connected with the first node, forming a circular loop in the circular linked list.

8
Circular link lists can either be singly or doubly-linked lists.

• The next node's next pointer will point to the first node to form a singly linked list.

• The previous pointer of the first node keeps the address of the last node to form a doubly-linked list.

Flowchart For Link List:

9
10
Algorithm For Link List
1. START

2. Create a node to store the data

3. Check if the list is empty

4. If the list is empty, add the data to the node and assign the head pointer to it.

5 If the list is not empty, add the data to a node and link to the current head. Assign the head to the
newly added node.

6. END

Program:
#include<stdio.h>
#include<stdlib.h> struct
node
{ int
data;
struct node *next;
};
struct node *head;

void beginsert ();


void lastinsert ();
void randominsert();
void begin_delete();
void last_delete();
void random_delete();
void display(); void
search(); int main ()
{
int choice =0;
while(choice != 9)
{
printf("\n\n********Main Menu********\n");
printf("\nChoose one option from the following list ...\n");

printf("\n===============================================\n"
);

11
printf("\n1.Insert in begining\n2.Insert at last\n3.Insert at any random
location\n4.Delete from Beginning\n 5.Delete from last\n6.Delete node after specified
location\n7.Search for an element\n8.Show\n9.Exit\n");
printf("\nEnter your choice?\n");
scanf("\n%d",&choice);
switch(choice)
{ case 1:
beginsert();
break; case 2:
lastinsert();
break; case 3:
randominsert();
break;
case 4:
begin_delete();
break; case 5:
last_delete();
break; case 6:
random_delete();
break;
case 7:
search();
break; case
8:
display();
break; case
9: exit(0);
break;
default:
printf("Please enter valid choice..");
}
}
}
void beginsert()
{
struct node *ptr;
int item;
ptr = (struct node *) malloc(sizeof(struct node *));
if(ptr == NULL)
{
printf("\nOVERFLOW");
}
else
{
printf("\nEnter value\n");
scanf("%d",&item); ptr->data = item;
ptr->next = head; head = ptr;
printf("\nNode inserted");

12
}

}
void lastinsert()
{
struct node *ptr,*temp;
int item;
ptr = (struct node*)malloc(sizeof(struct node));
if(ptr == NULL)
{
printf("\nOVERFLOW");
}
else
{
printf("\nEnter value?\n");
scanf("%d",&item); ptr->data
= item;
if(head == NULL)
{
ptr -> next = NULL;
head = ptr;
printf("\nNode inserted");
}
else
{
temp = head;
while (temp -> next != NULL)
{
temp = temp -> next;
}
temp->next = ptr;
ptr->next = NULL;
printf("\nNode inserted");

}
}
}
void randominsert()
{ int i,loc,item;
struct node *ptr, *temp;
ptr = (struct node *) malloc (sizeof(struct node));
if(ptr == NULL)
{
printf("\nOVERFLOW");
}
else {

13
printf("\nEnter element value");
scanf("%d",&item); ptr->data
= item;
printf("\nEnter the location after which you want to insert ");
scanf("\n%d",&loc); temp=head; for(i=0;i<loc;i++)
{
temp = temp->next;
if(temp == NULL)
{
printf("\ncan't insert\n");
return;
}

}
ptr ->next = temp ->next;
temp ->next = ptr;
printf("\nNode inserted");
}
}
void begin_delete()
{
struct node *ptr;
if(head == NULL)
{
printf("\nList is empty\n");
}
else
{
ptr = head;
head = ptr->next;
free(ptr);
printf("\nNode deleted from the begining ...\n");
}
}
void last_delete()
{
struct node *ptr,*ptr1;
if(head == NULL)
{
printf("\nlist is empty");
}
else if(head -> next == NULL)
{
head = NULL;
free(head);
printf("\nOnly node of the list deleted ...\n");
}

14
else
{
ptr = head;
while(ptr->next != NULL)
{
ptr1 = ptr;
ptr = ptr ->next;
}
ptr1->next = NULL;
free(ptr);
printf("\nDeleted Node from the last ...\n");
}
}
void random_delete()
{
struct node *ptr,*ptr1;
int loc,i;
printf("\n Enter the location of the node after which you want to perform deletion
\n");
scanf("%d",&loc);
ptr=head;
for(i=0;i<loc;i++)
{
ptr1 = ptr;
ptr = ptr->next;

if(ptr == NULL)
{
printf("\nCan't delete");
return;
}
}
ptr1 ->next = ptr ->next;
free(ptr);
printf("\nDeleted node %d ",loc+1);
}
void search()
{
struct node *ptr;
int item,i=0,flag;
ptr = head; if(ptr
== NULL)
{
printf("\nEmpty List\n");
}
else

15
{
printf("\nEnter item which you want to search?\n");
scanf("%d",&item);
while (ptr!=NULL)
{
if(ptr->data == item)
{
printf("item found at location %d ",i+1);
flag=0;
} else
{
flag=1;
} i++;
ptr = ptr -> next;
}
if(flag==1)
{
printf("Item not found\n");
}
}

void display()
{
struct node *ptr;
ptr = head;
if(ptr == NULL)
{
printf("Nothing to print");
}
else
{
printf("\nprinting values . . . . .\n");
while (ptr!=NULL)
{
printf("\n%d",ptr->data);
ptr = ptr -> next;
}
}
}

16
Output:

17
18

You might also like