SlideShare a Scribd company logo
Linked List
A Linear Data Structure
SONI GUPTA
ASSISTANT PROFESSOR (NPIU-TEQIP III )
HBTU KANPUR, UP
TEQIP
-III
 A linked list consists of nodes where each node contains a data field and a
reference(link/pointer) to the next node in the list.

TEQIP
-III
head
100 600200 400
200 600 400
TEQIP
-III
head
Declaring a Linked list
 a linked list can be implemented using structure and pointers .
struct Node{
int data;
struct Node *Next;
};
 Next is a self-referencing pointer
TEQIP
-III
Types of Linked Lists
 Singly Linked List
 Doubly Linked List
 Circular Linked List
TEQIP
-III
Singly Linked List
 Singly linked lists contain nodes which have a data part as well as an address,
which points to the next node.
TEQIP
-III
Doubly Linked List
 In a doubly linked list, each node contains a data part and two addresses, one for
the previous node and one for the next node.
TEQIP
-III
Doubly Linked list
300100 200
300100200 200
TEQIP
-III
Circular linked list
 In circular linked list the last node of the linked list holds the address of the first
node, forming a circular chain.
 Circular Singly linked list
TEQIP
-III
 Circular doubly linked list
TEQIP
-III
Operation on a Linked List
 Insert a Node
 Insert at first position
 Insert at last position
 Insert in between the linked list
 Delete
 Traverse
 Copy
TEQIP
-III
Advantages
 Linked list is dynamic in nature which allocates the memory when required.
 Insertion and deletion operations can be easily implemented.
 Linked List reduces the access time.
 In Linked Lists we don't need to know the size in advance.
TEQIP
-III
Disadvantages
 The memory is wasted as pointers require extra memory for storage.
 No element can be accessed randomly. It has to access each node sequentially.
 Reverse Traversing is difficult linked list.
TEQIP
-III
Array vs. Linked List
Array
 Array supports Random Access.
 Accessing elements in an array is fast with a
constant time complexity of O(1)
 In an array, elements are stored in contiguous
memory location or consecutive manner in the
memory.
 Memory is allocated as soon as the array is
declared, at compile time. It's also known
as Static Memory Allocation.
 Size of the array must be specified at time of
array declaration.
Linked List
 Linked List supports Sequential Access.
 To access nth element of a linked list, time
complexity is O(n).
 In a linked list, new elements can be stored
anywhere in the memory.
 Memory is allocated at runtime, as and when a
new node is added. It's also known as Dynamic
Memory Allocation.
 Size of a Linked list is variable. It grows at
runtime, as more nodes are added to it.
TEQIP
-III

More Related Content

PPTX
Data structure and its types
PPT
Lecture 2c stacks
PPTX
Linked lists
PPTX
Data structures logical and physical
ODP
Hyper table
PPTX
Link list
PPTX
Link list
PPTX
Linked lists linked lists vs Arrays.pptx
Data structure and its types
Lecture 2c stacks
Linked lists
Data structures logical and physical
Hyper table
Link list
Link list
Linked lists linked lists vs Arrays.pptx

Similar to Linked list part-1 (20)

PPTX
Data Structures and Algorithms - Lec 05.pptx
DOCX
Linked List
PPT
Lecture 2b lists
PPTX
Data Structures-UNIT Four_Linked_List.pptx
PPTX
Linked list
PPTX
Linked Lists in Data Structures ppt .pptx
PPTX
Linked List Representation of a Linked List.pptx
PDF
DS Module 03.pdf
PPT
ANOITO2341988888888888888888888885555.ppt
PPTX
Linked_List_Presentation_1.pptxjsjkskxjjdjekdlkdjmdkdk
PPTX
Linked List
PPTX
Linked list
PPTX
Linear Data Structures - List, Stack and Queue
DOCX
Link list assi
PPTX
LINKED LIST.pptx
PDF
In this lab we will write code for working with a Linked List. Node .pdf
PPTX
Linked list in Data Structure and Algorithm
PPTX
Linked list
PPTX
Lecture ............ 3 - Linked Lists.pptx
Data Structures and Algorithms - Lec 05.pptx
Linked List
Lecture 2b lists
Data Structures-UNIT Four_Linked_List.pptx
Linked list
Linked Lists in Data Structures ppt .pptx
Linked List Representation of a Linked List.pptx
DS Module 03.pdf
ANOITO2341988888888888888888888885555.ppt
Linked_List_Presentation_1.pptxjsjkskxjjdjekdlkdjmdkdk
Linked List
Linked list
Linear Data Structures - List, Stack and Queue
Link list assi
LINKED LIST.pptx
In this lab we will write code for working with a Linked List. Node .pdf
Linked list in Data Structure and Algorithm
Linked list
Lecture ............ 3 - Linked Lists.pptx
Ad

Recently uploaded (20)

PPTX
UNIT - 3 Total quality Management .pptx
PDF
BIO-INSPIRED ARCHITECTURE FOR PARSIMONIOUS CONVERSATIONAL INTELLIGENCE : THE ...
PDF
PPT on Performance Review to get promotions
PPTX
Current and future trends in Computer Vision.pptx
PDF
COURSE DESCRIPTOR OF SURVEYING R24 SYLLABUS
PPTX
UNIT 4 Total Quality Management .pptx
PPTX
CURRICULAM DESIGN engineering FOR CSE 2025.pptx
PDF
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PDF
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
PDF
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
PPTX
Fundamentals of safety and accident prevention -final (1).pptx
PDF
Analyzing Impact of Pakistan Economic Corridor on Import and Export in Pakist...
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPTX
Information Storage and Retrieval Techniques Unit III
PDF
86236642-Electric-Loco-Shed.pdf jfkduklg
PPT
Introduction, IoT Design Methodology, Case Study on IoT System for Weather Mo...
PPT
Occupational Health and Safety Management System
PDF
EXPLORING LEARNING ENGAGEMENT FACTORS INFLUENCING BEHAVIORAL, COGNITIVE, AND ...
PPTX
communication and presentation skills 01
UNIT - 3 Total quality Management .pptx
BIO-INSPIRED ARCHITECTURE FOR PARSIMONIOUS CONVERSATIONAL INTELLIGENCE : THE ...
PPT on Performance Review to get promotions
Current and future trends in Computer Vision.pptx
COURSE DESCRIPTOR OF SURVEYING R24 SYLLABUS
UNIT 4 Total Quality Management .pptx
CURRICULAM DESIGN engineering FOR CSE 2025.pptx
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
Fundamentals of safety and accident prevention -final (1).pptx
Analyzing Impact of Pakistan Economic Corridor on Import and Export in Pakist...
R24 SURVEYING LAB MANUAL for civil enggi
Information Storage and Retrieval Techniques Unit III
86236642-Electric-Loco-Shed.pdf jfkduklg
Introduction, IoT Design Methodology, Case Study on IoT System for Weather Mo...
Occupational Health and Safety Management System
EXPLORING LEARNING ENGAGEMENT FACTORS INFLUENCING BEHAVIORAL, COGNITIVE, AND ...
communication and presentation skills 01
Ad

Linked list part-1

  • 1. Linked List A Linear Data Structure SONI GUPTA ASSISTANT PROFESSOR (NPIU-TEQIP III ) HBTU KANPUR, UP TEQIP -III
  • 2.  A linked list consists of nodes where each node contains a data field and a reference(link/pointer) to the next node in the list.  TEQIP -III head
  • 3. 100 600200 400 200 600 400 TEQIP -III head
  • 4. Declaring a Linked list  a linked list can be implemented using structure and pointers . struct Node{ int data; struct Node *Next; };  Next is a self-referencing pointer TEQIP -III
  • 5. Types of Linked Lists  Singly Linked List  Doubly Linked List  Circular Linked List TEQIP -III
  • 6. Singly Linked List  Singly linked lists contain nodes which have a data part as well as an address, which points to the next node. TEQIP -III
  • 7. Doubly Linked List  In a doubly linked list, each node contains a data part and two addresses, one for the previous node and one for the next node. TEQIP -III
  • 8. Doubly Linked list 300100 200 300100200 200 TEQIP -III
  • 9. Circular linked list  In circular linked list the last node of the linked list holds the address of the first node, forming a circular chain.  Circular Singly linked list TEQIP -III
  • 10.  Circular doubly linked list TEQIP -III
  • 11. Operation on a Linked List  Insert a Node  Insert at first position  Insert at last position  Insert in between the linked list  Delete  Traverse  Copy TEQIP -III
  • 12. Advantages  Linked list is dynamic in nature which allocates the memory when required.  Insertion and deletion operations can be easily implemented.  Linked List reduces the access time.  In Linked Lists we don't need to know the size in advance. TEQIP -III
  • 13. Disadvantages  The memory is wasted as pointers require extra memory for storage.  No element can be accessed randomly. It has to access each node sequentially.  Reverse Traversing is difficult linked list. TEQIP -III
  • 14. Array vs. Linked List Array  Array supports Random Access.  Accessing elements in an array is fast with a constant time complexity of O(1)  In an array, elements are stored in contiguous memory location or consecutive manner in the memory.  Memory is allocated as soon as the array is declared, at compile time. It's also known as Static Memory Allocation.  Size of the array must be specified at time of array declaration. Linked List  Linked List supports Sequential Access.  To access nth element of a linked list, time complexity is O(n).  In a linked list, new elements can be stored anywhere in the memory.  Memory is allocated at runtime, as and when a new node is added. It's also known as Dynamic Memory Allocation.  Size of a Linked list is variable. It grows at runtime, as more nodes are added to it. TEQIP -III