SlideShare a Scribd company logo
1 of 23
Link list
Supervised
Dr Nuri
Prepared by
Didar Rashad
2014-2015
Linked Lists
Linked Lists 2
Link list in data structure
Introduction to Linked List
1.Link list is a data Structure which consists of group
of nodes that forms a sequence.
2. Linked list is group of nodes in which each node
have link to next node to form a chain,
Linked List definition
1. Linked List is Series of Nodes
2. Each node Consist of two Parts Data Part & Pointer Part
3. Data part stores value of node Pointer Part stores the address of the next node
Linked List Types
 Singly Linked list
 Circular singly linked list
 Doubly linked lists
 Circular doubly linked lists
Singly Linked List
10 1000 200015 NULL20
First
Singly Linked list
 Each Node contain address of the next node to be followed.
 In Singly Linked List only Linear or
Forward Sequential movement is possible.
 Elements are accessed sequentially , no direct access is
allowed.
 First Node does not have predecessor while last node
does not have any successor.
 We can have multiple data fields inside Node but we have
only single “Link” for next node.
10004000
10 1000
2000
200015 400020
Circular Singly Linked List
Last node contains the address of the first node
First
Circular Singly Linked List
Doubly linked lists
 In Doubly Linked List , each node contain two
address fields .
 One address field for storing address of next
node to be followed and second address field
contain address of previous node linked to it.
 So Two way access is possible ,We can start
accessing nodes from start as well as from last .
 Like Singly Linked List also only Linear but
Bidirectional Sequential movement is
possible.
3000
2000 30001000
10 15 202000 1000 2000 10003000
First
Circular Doubly Linked list
Contains the address of first node and last
node
3000
2000 30001000
10 15 202000 1000 2000 10003000
First
Difference Between array and
Linked List
Access
Randomsequential
Memory Structure
Memory Allocation
Insert deletion
Difference Between
array and Linked List
array elements can be randomly Accessed
using Subscript Variable
, a[0],a[1],a[3] can be randomly accessed
While In Linked List We have to Traverse Through the
Linked List for Accessing Element.
So O(n) Time required for Accessing Element .
Generally In linked List Elements are
accessed Sequentially.
Access
Randomsequential
Memory Structure
But link list is not necessary to store next
element at the Consecutive memory
Location
In link list Element is stored at any
available Location , but the Pointer to that
memory location is stored in Previous
Node.
array is stored in contiguous
Memory Locations , i.e Suppose first
element is Stored at 2000 then Second
Integer element will be stored at 2001 .
As the Array elements are stored in contiguous
memory Locations , so While Inserting elements ,we
have to create space for Insertion.
So More time required for Creating space and
Inserting Element
Similarly We have to Delete the Element from given
Location and then Shift All successive elements up
by 1 position
Insert deletion
In Linked List we have to Just Change the Pointer
address field (Pointer),So Insertion and Deletion
Operations are quite easy to implement
Insert deletion
Memory Should be allocated at Compile-Time in
array .
at the time when Programmer is Writing Program,
array uses Static Memory Allocation
In Linked list memory can be allocated
at Run-Time ,
After executing Program
Linked List Uses Dynamic Memory
Allocation
Memory Allocation
Advantages of linked list
1.Linked List is Dynamic data Structure .
Linked List Data Structure is Dynamic in nature.
just create Linked List structure and memory will be allocated at run
time.
while running program at run time we can allocate much memory.
Oslo we can allocate any number of nodes .
Because this link list can grow and shrink during run time.
2. Insertion and Deletion Operations are Easier
Advantages of linked list
3. Efficient Memory Utilization , no need to pre-allocate memory
we don’t have to allocate memory at compile time.
Memory is allocated at run time,
so that Linked list data structure provides us strong
command on memory utilization.
4. Faster Access time , can be expanded in constant time
without memory overhead
5. Linear Data Structures such as array , Queue can be easily
implemented by using Linked list
Disadvantages of linked list
1. Wastage of memory
. Pointer Requires extra memory for
storage.
Suppose we want to store 3 integer data
items then we have to allocate memory -
in case of array
Memory Required in Array = 3 Integer *
Size
=3 * 2 bytes
= 6 bytes
Memory Required in LL = 3 Integer * Size of
Node
= 3 * Size of Node
Structure
= 3 * Size(data + address
pointer)
= 3 * (2 bytes + x bytes)
Disadvantages of linked list
2. No random Access
In Linked list no random access is given to user, we have
to access each node sequentially.
3. Heap space restriction
Whenever memory is dynamically allocated , It utilizes memory from heap.
Memory is allocated to Linked List at run time if only there is space
available in heap.
If there is insufficient space in heap then it can’t create any memory.
4. Reverse Traversing is difficult
In case if we are using singly linked list then it is very difficult to traverse
linked list from end.
If using doubly linked list then though it becomes easier to traverse from
end to start
Insertion
 Doubly linked lists
21
A B X C
A B C
p
A B C
p
X
q
p q
Deletion
 Doubly linked lists
Linked Lists 22
A B C D
p
A B C
D
p
A B C
Thank you

More Related Content

What's hot

Circular linked list
Circular linked listCircular linked list
Circular linked listchauhankapil
 
linked list in Data Structure, Simple and Easy Tutorial
linked list in Data Structure, Simple and Easy Tutoriallinked list in Data Structure, Simple and Easy Tutorial
linked list in Data Structure, Simple and Easy TutorialAfzal Badshah
 
Priority Queue in Data Structure
Priority Queue in Data StructurePriority Queue in Data Structure
Priority Queue in Data StructureMeghaj Mallick
 
Insertion in singly linked list
Insertion in singly linked listInsertion in singly linked list
Insertion in singly linked listKeval Bhogayata
 
Circular link list.ppt
Circular link list.pptCircular link list.ppt
Circular link list.pptTirthika Bandi
 
Data Structures with C Linked List
Data Structures with C Linked ListData Structures with C Linked List
Data Structures with C Linked ListReazul Islam
 
Doubly linked list
Doubly linked listDoubly linked list
Doubly linked listFahd Allebdi
 
Linked list in Data Structure and Algorithm
Linked list in Data Structure and Algorithm Linked list in Data Structure and Algorithm
Linked list in Data Structure and Algorithm KristinaBorooah
 
1.1 binary tree
1.1 binary tree1.1 binary tree
1.1 binary treeKrish_ver2
 
Polynomial reppresentation using Linkedlist-Application of LL.pptx
Polynomial reppresentation using Linkedlist-Application of LL.pptxPolynomial reppresentation using Linkedlist-Application of LL.pptx
Polynomial reppresentation using Linkedlist-Application of LL.pptxAlbin562191
 

What's hot (20)

single linked list
single linked listsingle linked list
single linked list
 
Circular linked list
Circular linked listCircular linked list
Circular linked list
 
linked list in Data Structure, Simple and Easy Tutorial
linked list in Data Structure, Simple and Easy Tutoriallinked list in Data Structure, Simple and Easy Tutorial
linked list in Data Structure, Simple and Easy Tutorial
 
Singly link list
Singly link listSingly link list
Singly link list
 
Linklist
LinklistLinklist
Linklist
 
Priority Queue in Data Structure
Priority Queue in Data StructurePriority Queue in Data Structure
Priority Queue in Data Structure
 
Doubly Linked List
Doubly Linked ListDoubly Linked List
Doubly Linked List
 
Binary search tree(bst)
Binary search tree(bst)Binary search tree(bst)
Binary search tree(bst)
 
Linked List
Linked ListLinked List
Linked List
 
Insertion in singly linked list
Insertion in singly linked listInsertion in singly linked list
Insertion in singly linked list
 
Linked list
Linked listLinked list
Linked list
 
Circular link list.ppt
Circular link list.pptCircular link list.ppt
Circular link list.ppt
 
Linkedlist
LinkedlistLinkedlist
Linkedlist
 
Data Structures with C Linked List
Data Structures with C Linked ListData Structures with C Linked List
Data Structures with C Linked List
 
Doubly linked list
Doubly linked listDoubly linked list
Doubly linked list
 
Linked list in Data Structure and Algorithm
Linked list in Data Structure and Algorithm Linked list in Data Structure and Algorithm
Linked list in Data Structure and Algorithm
 
1.1 binary tree
1.1 binary tree1.1 binary tree
1.1 binary tree
 
Linked list
Linked listLinked list
Linked list
 
Polynomial reppresentation using Linkedlist-Application of LL.pptx
Polynomial reppresentation using Linkedlist-Application of LL.pptxPolynomial reppresentation using Linkedlist-Application of LL.pptx
Polynomial reppresentation using Linkedlist-Application of LL.pptx
 
Linked list
Linked listLinked list
Linked list
 

Similar to Link list

Different types of Linked list.
Different types of Linked list.Different types of Linked list.
Different types of Linked list.JAYANTAOJHA
 
Data Structures and Algorithms - Lec 05.pptx
Data Structures and Algorithms - Lec 05.pptxData Structures and Algorithms - Lec 05.pptx
Data Structures and Algorithms - Lec 05.pptxRameshaFernando2
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure shameen khan
 
1.3 Linked List.pptx
1.3 Linked List.pptx1.3 Linked List.pptx
1.3 Linked List.pptxssuserd2f031
 
Linked list (introduction) 1
Linked list (introduction) 1Linked list (introduction) 1
Linked list (introduction) 1DrSudeshna
 
ds-lecture-4-171012041008 (1).pdf
ds-lecture-4-171012041008 (1).pdfds-lecture-4-171012041008 (1).pdf
ds-lecture-4-171012041008 (1).pdfKamranAli649587
 
Introduction to linked lists
Introduction to linked listsIntroduction to linked lists
Introduction to linked listspooja kumari
 
data structures and applications power p
data structures and applications power pdata structures and applications power p
data structures and applications power pMeghaKulkarni27
 
Linear Data Structures - List, Stack and Queue
Linear Data Structures - List, Stack and QueueLinear Data Structures - List, Stack and Queue
Linear Data Structures - List, Stack and QueueSelvaraj Seerangan
 
2 marks- DS using python
2 marks- DS using python2 marks- DS using python
2 marks- DS using pythonLavanyaJ28
 
Static arrays are structures whose size is fixed at compile time and.pdf
Static arrays are structures whose size is fixed at compile time and.pdfStatic arrays are structures whose size is fixed at compile time and.pdf
Static arrays are structures whose size is fixed at compile time and.pdfanjanacottonmills
 

Similar to Link list (20)

Different types of Linked list.
Different types of Linked list.Different types of Linked list.
Different types of Linked list.
 
Data Structures and Algorithms - Lec 05.pptx
Data Structures and Algorithms - Lec 05.pptxData Structures and Algorithms - Lec 05.pptx
Data Structures and Algorithms - Lec 05.pptx
 
linked list.pptx
linked list.pptxlinked list.pptx
linked list.pptx
 
Linked List
Linked ListLinked List
Linked List
 
Linkedlists
LinkedlistsLinkedlists
Linkedlists
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure
 
1.3 Linked List.pptx
1.3 Linked List.pptx1.3 Linked List.pptx
1.3 Linked List.pptx
 
Linked list (introduction) 1
Linked list (introduction) 1Linked list (introduction) 1
Linked list (introduction) 1
 
ds-lecture-4-171012041008 (1).pdf
ds-lecture-4-171012041008 (1).pdfds-lecture-4-171012041008 (1).pdf
ds-lecture-4-171012041008 (1).pdf
 
Linked list (1).pptx
Linked list (1).pptxLinked list (1).pptx
Linked list (1).pptx
 
Linked list
Linked listLinked list
Linked list
 
Introduction to linked lists
Introduction to linked listsIntroduction to linked lists
Introduction to linked lists
 
data structures and applications power p
data structures and applications power pdata structures and applications power p
data structures and applications power p
 
Link list assi
Link list assiLink list assi
Link list assi
 
Data structure day1
Data structure day1Data structure day1
Data structure day1
 
Link list
Link listLink list
Link list
 
Linear Data Structures - List, Stack and Queue
Linear Data Structures - List, Stack and QueueLinear Data Structures - List, Stack and Queue
Linear Data Structures - List, Stack and Queue
 
unit 2- PPT.pdf
unit 2- PPT.pdfunit 2- PPT.pdf
unit 2- PPT.pdf
 
2 marks- DS using python
2 marks- DS using python2 marks- DS using python
2 marks- DS using python
 
Static arrays are structures whose size is fixed at compile time and.pdf
Static arrays are structures whose size is fixed at compile time and.pdfStatic arrays are structures whose size is fixed at compile time and.pdf
Static arrays are structures whose size is fixed at compile time and.pdf
 

Recently uploaded

SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecturerahul_net
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZABSYZ Inc
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Rob Geurden
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Mater
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 

Recently uploaded (20)

SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecture
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZ
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 

Link list

  • 1. Link list Supervised Dr Nuri Prepared by Didar Rashad 2014-2015
  • 3.
  • 4. Link list in data structure Introduction to Linked List 1.Link list is a data Structure which consists of group of nodes that forms a sequence. 2. Linked list is group of nodes in which each node have link to next node to form a chain,
  • 5. Linked List definition 1. Linked List is Series of Nodes 2. Each node Consist of two Parts Data Part & Pointer Part 3. Data part stores value of node Pointer Part stores the address of the next node
  • 6. Linked List Types  Singly Linked list  Circular singly linked list  Doubly linked lists  Circular doubly linked lists
  • 7. Singly Linked List 10 1000 200015 NULL20 First Singly Linked list  Each Node contain address of the next node to be followed.  In Singly Linked List only Linear or Forward Sequential movement is possible.  Elements are accessed sequentially , no direct access is allowed.  First Node does not have predecessor while last node does not have any successor.  We can have multiple data fields inside Node but we have only single “Link” for next node.
  • 8. 10004000 10 1000 2000 200015 400020 Circular Singly Linked List Last node contains the address of the first node First Circular Singly Linked List
  • 9. Doubly linked lists  In Doubly Linked List , each node contain two address fields .  One address field for storing address of next node to be followed and second address field contain address of previous node linked to it.  So Two way access is possible ,We can start accessing nodes from start as well as from last .  Like Singly Linked List also only Linear but Bidirectional Sequential movement is possible. 3000 2000 30001000 10 15 202000 1000 2000 10003000 First
  • 10. Circular Doubly Linked list Contains the address of first node and last node 3000 2000 30001000 10 15 202000 1000 2000 10003000 First
  • 11. Difference Between array and Linked List Access Randomsequential Memory Structure Memory Allocation Insert deletion Difference Between array and Linked List
  • 12. array elements can be randomly Accessed using Subscript Variable , a[0],a[1],a[3] can be randomly accessed While In Linked List We have to Traverse Through the Linked List for Accessing Element. So O(n) Time required for Accessing Element . Generally In linked List Elements are accessed Sequentially. Access Randomsequential
  • 13. Memory Structure But link list is not necessary to store next element at the Consecutive memory Location In link list Element is stored at any available Location , but the Pointer to that memory location is stored in Previous Node. array is stored in contiguous Memory Locations , i.e Suppose first element is Stored at 2000 then Second Integer element will be stored at 2001 .
  • 14. As the Array elements are stored in contiguous memory Locations , so While Inserting elements ,we have to create space for Insertion. So More time required for Creating space and Inserting Element Similarly We have to Delete the Element from given Location and then Shift All successive elements up by 1 position Insert deletion
  • 15. In Linked List we have to Just Change the Pointer address field (Pointer),So Insertion and Deletion Operations are quite easy to implement Insert deletion
  • 16. Memory Should be allocated at Compile-Time in array . at the time when Programmer is Writing Program, array uses Static Memory Allocation In Linked list memory can be allocated at Run-Time , After executing Program Linked List Uses Dynamic Memory Allocation Memory Allocation
  • 17. Advantages of linked list 1.Linked List is Dynamic data Structure . Linked List Data Structure is Dynamic in nature. just create Linked List structure and memory will be allocated at run time. while running program at run time we can allocate much memory. Oslo we can allocate any number of nodes . Because this link list can grow and shrink during run time. 2. Insertion and Deletion Operations are Easier
  • 18. Advantages of linked list 3. Efficient Memory Utilization , no need to pre-allocate memory we don’t have to allocate memory at compile time. Memory is allocated at run time, so that Linked list data structure provides us strong command on memory utilization. 4. Faster Access time , can be expanded in constant time without memory overhead 5. Linear Data Structures such as array , Queue can be easily implemented by using Linked list
  • 19. Disadvantages of linked list 1. Wastage of memory . Pointer Requires extra memory for storage. Suppose we want to store 3 integer data items then we have to allocate memory - in case of array Memory Required in Array = 3 Integer * Size =3 * 2 bytes = 6 bytes Memory Required in LL = 3 Integer * Size of Node = 3 * Size of Node Structure = 3 * Size(data + address pointer) = 3 * (2 bytes + x bytes)
  • 20. Disadvantages of linked list 2. No random Access In Linked list no random access is given to user, we have to access each node sequentially. 3. Heap space restriction Whenever memory is dynamically allocated , It utilizes memory from heap. Memory is allocated to Linked List at run time if only there is space available in heap. If there is insufficient space in heap then it can’t create any memory. 4. Reverse Traversing is difficult In case if we are using singly linked list then it is very difficult to traverse linked list from end. If using doubly linked list then though it becomes easier to traverse from end to start
  • 21. Insertion  Doubly linked lists 21 A B X C A B C p A B C p X q p q
  • 22. Deletion  Doubly linked lists Linked Lists 22 A B C D p A B C D p A B C

Editor's Notes

  1. 4/7/2015 11:07 AM