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

Doubly Linked List
Doubly Linked ListDoubly Linked List
Doubly Linked ListNinad Mankar
 
Ppt on Linked list,stack,queue
Ppt on Linked list,stack,queuePpt on Linked list,stack,queue
Ppt on Linked list,stack,queueSrajan Shukla
 
Priority Queue in Data Structure
Priority Queue in Data StructurePriority Queue in Data Structure
Priority Queue in Data StructureMeghaj Mallick
 
Searching & Sorting Algorithms
Searching & Sorting AlgorithmsSearching & Sorting Algorithms
Searching & Sorting AlgorithmsRahul Jamwal
 
Double Linked List (Algorithm)
Double Linked List (Algorithm)Double Linked List (Algorithm)
Double Linked List (Algorithm)Huba Akhtar
 
Data Structure and Algorithms Linked List
Data Structure and Algorithms Linked ListData Structure and Algorithms Linked List
Data Structure and Algorithms Linked ListManishPrajapati78
 
Linked List, Types of Linked LIst, Various Operations, Applications of Linked...
Linked List, Types of Linked LIst, Various Operations, Applications of Linked...Linked List, Types of Linked LIst, Various Operations, Applications of Linked...
Linked List, Types of Linked LIst, Various Operations, Applications of Linked...Balwant Gorad
 
Algorithms Lecture 6: Searching Algorithms
Algorithms Lecture 6: Searching AlgorithmsAlgorithms Lecture 6: Searching Algorithms
Algorithms Lecture 6: Searching AlgorithmsMohamed Loey
 
What is Stack, Its Operations, Queue, Circular Queue, Priority Queue
What is Stack, Its Operations, Queue, Circular Queue, Priority QueueWhat is Stack, Its Operations, Queue, Circular Queue, Priority Queue
What is Stack, Its Operations, Queue, Circular Queue, Priority QueueBalwant Gorad
 
Introduction to stack
Introduction to stackIntroduction to stack
Introduction to stackvaibhav2910
 
Insertion in singly linked list
Insertion in singly linked listInsertion in singly linked list
Insertion in singly linked listKeval Bhogayata
 
Circular linked list
Circular linked listCircular linked list
Circular linked listchauhankapil
 

What's hot (20)

Doubly Linked List
Doubly Linked ListDoubly Linked List
Doubly Linked List
 
Linked list
Linked listLinked list
Linked list
 
Linked list
Linked listLinked list
Linked list
 
Ppt on Linked list,stack,queue
Ppt on Linked list,stack,queuePpt on Linked list,stack,queue
Ppt on Linked list,stack,queue
 
Priority Queue in Data Structure
Priority Queue in Data StructurePriority Queue in Data Structure
Priority Queue in Data Structure
 
Searching & Sorting Algorithms
Searching & Sorting AlgorithmsSearching & Sorting Algorithms
Searching & Sorting Algorithms
 
Double Linked List (Algorithm)
Double Linked List (Algorithm)Double Linked List (Algorithm)
Double Linked List (Algorithm)
 
Queue Data Structure
Queue Data StructureQueue Data Structure
Queue Data Structure
 
Data Structure and Algorithms Linked List
Data Structure and Algorithms Linked ListData Structure and Algorithms Linked List
Data Structure and Algorithms Linked List
 
Linked List
Linked ListLinked List
Linked List
 
Linked List, Types of Linked LIst, Various Operations, Applications of Linked...
Linked List, Types of Linked LIst, Various Operations, Applications of Linked...Linked List, Types of Linked LIst, Various Operations, Applications of Linked...
Linked List, Types of Linked LIst, Various Operations, Applications of Linked...
 
Queues in C++
Queues in C++Queues in C++
Queues in C++
 
Queues
QueuesQueues
Queues
 
Algorithms Lecture 6: Searching Algorithms
Algorithms Lecture 6: Searching AlgorithmsAlgorithms Lecture 6: Searching Algorithms
Algorithms Lecture 6: Searching Algorithms
 
What is Stack, Its Operations, Queue, Circular Queue, Priority Queue
What is Stack, Its Operations, Queue, Circular Queue, Priority QueueWhat is Stack, Its Operations, Queue, Circular Queue, Priority Queue
What is Stack, Its Operations, Queue, Circular Queue, Priority Queue
 
B and B+ tree
B and B+ treeB and B+ tree
B and B+ tree
 
Introduction to stack
Introduction to stackIntroduction to stack
Introduction to stack
 
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
 
Circular linked list
Circular linked listCircular linked list
Circular 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
 
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
 
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
 

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.
 
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
 
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
 

Recently uploaded

CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceanilsa9823
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 

Recently uploaded (20)

CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 

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