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 Star Finish
members
t Date
Date
49. VAIBHAV RAJU KOLI
50. THAKUR YASH DHANRAJ
Searching the topic 21/08/23 31/08/23
1.
for micro-project

Collect information 49. VAIBHAV RAJU KOLI


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

49. VAIBHAV RAJU KOLI


Collect information
50. THAKUR YASH DHANRAJ
from the
3. 16/09/23 30/09/23
DSU(22317)
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 50. THAKUR YASH DHANRAJ
5. 17/10/23 23/10/23
it using MS word

51. PATEL ANAS JAHANGEER

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

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 lineaí data stíuctuíe that stoíes a collection of data elements dynamically.

• Nodes íepíesent those data elements, and links oí pointeís connect each node.

• Each node consists of two fields, the infoímation stoíed in a linked list and a pointeí that stoíes
the addíess of its next node.

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

6
• A linked list can gíow and shíink its size, as peí the íequiíement.

• It does not waste memoíy space.

Repíesentation of a Linked List


ľhis íepíesentation of a linked list depicts that each node consists of two fields. ľhe fiíst field consists of data,
and the second field consists of pointeís that point to anotheí node.

Heíe, the staít pointeí stoíes the addíess of the fiíst node, and at the end, theíe is a null pointeí that states the end of
the Linked List.

ľypes of Linked Lists

Singly Linked List


A singly linked list is the most common type of linked list. Each node has data and an addíess field that contains a
íefeíence to the next node.

7
Doubly Linked List
ľheíe aíe two pointeí stoíage blocks in the doubly linked list. ľhe fiíst pointeí block in each node stoíes the
addíess of the píevious node. Hence, in the doubly linked inventoíy, theíe aíe thíee fields
that aíe the píevious pointeís, that contain a íefeíence to the píevious node. ľhen theíe is the data, and last you
have the next pointeí, which points to the next node. ľhus, you can go in both diíections
(backwaíd and foíwaíd).

Ciículaí Linked List


ľhe ciículaí linked list is extíemely similaí to the singly linked list. ľhe only diffeíence is that the last node is
connected with the fiíst node, foíming a ciículaí loop in the ciículaí linked list.

8
Ciículaí link lists can eitheí be singly oí doubly-linked lists.

• ľhe next node's next pointeí will point to the fiíst node to foím a singly linked list.

• ľhe píevious pointeí of the fiíst node keeps the addíess of the last node to foím a doubly-linked list.

Ïlowchaít Ïoí Link List:

9
10
Algoíithm Ïoí Link List
1. SľARľ

2. Cíeate a node to stoíe 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 pointeí to it.

5 If the list is not empty, add the data to a node and link to the cuííent 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"
);

1
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");

1
}

}
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 {

1
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");
}

1
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

1
{
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;
}
}
}

1
Output:

1
1

You might also like