0% found this document useful (0 votes)
13 views

Linked List Data Structure1.1

Uploaded by

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

Linked List Data Structure1.1

Uploaded by

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

LINKED LIST

DATA
STRUCTURE
LINKED LIST DATA STRUCTURE

 A linked list is a fundamental data


structure in computer science. It mainly
allows efficient insertion and deletion
operations compared to arrays. Like
arrays, it is also used to implement other
data structures like stack, queue and
deque.
Linked List

* A linked list is a linear data structure that


consists of a series of nodes connected by
pointers (in C or C++) or references (in Java,
Python and JavaScript). Each node contains data
and a pointer/reference to the next node in the
list. Unlike arrays, linked lists allow for efficient
insertion or removal of elements from any
position in the list, as the nodes are not stored
contiguously in memory.
Linked Lists vs Arrays

Linked List
 Data Structure: Non-contiguous
 Memory Allocation: Typically allocated one by
one to individual elements
 Insertion/Deletion: Efficient
 Access: Sequential
Linked Lists vs Arrays

Array
* Data Structure: Contiguous
* Memory Allocation: Typically allocated to the
whole array
* Insertion/Deletion: Inefficient
* Access: Random
TYPES OF LINKED LIST
 Singly Linked List
 Doubly Linked List
 Circular Linked List
Introduction to Singly Linked List
 Singly linked list is a linear data
structure in which the elements are not
stored in contiguous memory locations
and each element is connected only to
its next element using a pointer.
Doubly Linked List
 A doubly linked list is a more complex data
structure than a singly linked list, but it offers
several advantages. The main advantage of a
doubly linked list is that it allows for efficient
traversal of the list in both directions. This is
because each node in the list contains a pointer
to the previous node and a pointer to the next
node. This allows for quick and easy insertion
and deletion of nodes from the list, as well as
efficient traversal of the list in both directions.
What is a Doubly Linked List?

A doubly linked list is a data structure that consists


of a set of nodes, each of which contains a value and
two pointers, one pointing to the previous node in
the list and one pointing to the next node in the list.
This allows for efficient traversal of the list in both
directions, making it suitable for applications where
frequent insertions and deletions are required.
Representation of Doubly Linked List in Data Structure

In a data structure, a doubly linked list is


represented using nodes that have three
fields:

* Data
* A pointer to the next node (next)
*A pointer to the previous node
(prev)
Introduction to Circular Linked List
 A circular linked list is a data structure where
the last node connects back to the first,
forming a loop. This structure allows for
continuous traversal without any interruptions.
Circular linked lists are especially helpful for
tasks like scheduling and managing playlists,
this allowing for smooth navigation. In this
tutorial, we’ll cover the basics of circular linked
lists, how to work with them, their advantages
What is a Circular Linked List?

 A circular linked list is a special type of linked list


where all the nodes are connected to form a
circle. Unlike a regular linked list, which ends with
a node pointing to NULL, the last node in a
circular linked list points back to the first node.
This means that you can keep traversing the list
without ever reaching a NULL value.
Types of Circular Linked Lists
We can create a circular linked list from both
singly linked lists and doubly linked lists. So,
circular linked list are basically of two types:
1. Circular Singly Linked List

In Circular Singly Linked List, each node has just one


pointer called the “next” pointer. The next pointer of
last node points back to the first node and this
results in forming a circle. In this type of Linked list
we can only move through the list in one direction.
2. Circular Doubly Linked List
In circular doubly linked list, each node has two
pointers prev and next, similar to doubly linked list.
The prev pointer points to the previous node and the
next points to the next node. Here, in addition to the
last node storing the address of the first node, the
first node will also store the address of the last node.

You might also like