0% found this document useful (0 votes)
6 views1 page

Linked List

A linked list is a dynamic linear data structure that consists of nodes connected via pointers, allowing for efficient memory use and flexible item rearrangement. Each node contains a data value and a pointer to the next node, enabling operations like insertion and deletion at various locations. Linked lists can implement other data structures such as stacks, queues, and graphs.

Uploaded by

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

Linked List

A linked list is a dynamic linear data structure that consists of nodes connected via pointers, allowing for efficient memory use and flexible item rearrangement. Each node contains a data value and a pointer to the next node, enabling operations like insertion and deletion at various locations. Linked lists can implement other data structures such as stacks, queues, and graphs.

Uploaded by

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

Linked List:

11 February 2025
12:12
Definition:
A linked list is a linear data structure which can store a collection of
"nodes" connected together via links i.e. pointers. Linked lists nodes
not stored at a contiguous location, rather they are linked using
to the different memory locations. A node consists of the data value
a pointer to the address of the next node within the linked list.
A LL is a DS which can change during execution, meaning it can grow
or shrink in size during execution of a program. It also provides
flexibility in allowing the items to be rearranged efficiently by
providing various operations such as Inserting an element /* Initialize nodes */
end, any specific location), Deleting an element (beginning, end, any struct node *head;
struct node *one = NULL;
specific location). struct node *two = NULL;
struct node *three = NULL;
From <https://www.tutorialspoint.com/data_structures_algorithms/linked_list_algorithms.htm>
/* Allocate memory */
one = malloc(sizeof(struct node));
A linked list is a dynamic linear data structure whose memory size can two = malloc(sizeof(struct node));
be allocated or de-allocated at run time based on the operation three = malloc(sizeof(struct node));
or deletion, this helps in using system memory efficiently. Linked lists /* Assign data values */
can be used to implement various data structures like a stack, queue, one->data = 1;
graph, hash maps, etc. two->data = 2;
three->data=3;

/* Connect nodes */
Representation of Linked List: one->next = two;
two->next = three;
struct node three->next = NULL;
{
int data; /* Save address of first node in head */
struct node *next; head = one;
};
Each struct node has a data item and a pointer to another struct node. Let us create a simple
Linked List with three items to understand how this works.

Linked List Page 1

You might also like