Download presentation
Presentation is loading. Please wait.
1
UNIT – I Linked Lists
2
Outline Introduction Insertion Description Deletion Description
Basic Node Implementation Conclusion
3
Outline Introduction Insertion Description Deletion Description
Basic Node Implementation Conclusion
4
Introduction Definitions Advantages Lists and arrays
Nodes and pointers Single Linked Lists Double Linked Lists Circular Lists Advantages
5
Introduction Definitions Advantages Lists and arrays
Nodes and pointers Single Linked Lists Double Linked Lists Circular Lists Advantages
6
Lists and arrays Lists:
7
Lists and arrays Arrays: Index 1 2 3 Value 44 5 96
{Size of the following array is = 4} Index 1 2 3 Value 44 5 96
8
Introduction Definitions Advantages Lists and arrays
Nodes and pointers Single Linked Lists Double Linked Lists Circular Lists Advantages
9
Nodes and pointers
10
Introduction Definitions Advantages Lists and arrays
Nodes and pointers Single Linked Lists Double Linked Lists Circular Lists Advantages
11
Single linked lists
12
Introduction Definitions Advantages Lists and arrays
Nodes and pointers Single Linked Lists Double Linked Lists Circular Lists Advantages
13
Double Linked Lists
14
Introduction Definitions Advantages Lists and arrays
Nodes and pointers Single Linked Lists Double Linked Lists Circular Lists Advantages
15
Circular Lists
16
Introduction Definitions Advantages Lists and arrays
Nodes and pointers Single Linked Lists Double Linked Lists Circular Lists Advantages
17
Advantages The Linked List advantages are collected because of the array disadvantages, array disadvantages are: Array Size Memory allocation Insertion and Deletion
18
Outline Introduction Insertion Description Deletion Description
Basic Node Implementation Conclusion
19
Insertion Description
Insertion at the top of the list Insertion at the end of the list Insertion in the middle of the list
20
Insertion Description
Insertion at the top of the list Insertion at the end of the list Insertion in the middle of the list
21
Insertion at the top Steps: Create a Node Set the node data Values
Connect the pointers
22
Insertion Description
48 17 142 head // Follow the previous steps and we get Step 1 Step 2 Step 3 head 93
23
Insertion Description
Insertion at the top of the list Insertion at the end of the list Insertion in the middle of the list
24
Insertion at the end Steps: Create a Node Set the node data Values
Connect the pointers
25
Insertion Description
48 17 142 head // Follow the previous steps and we get Step 1 Step 2 Step 3
26
Insertion Description
Insertion at the top of the list Insertion at the end of the list Insertion in the middle of the list
27
Insertion in the middle
Steps: Create a Node Set the node data Values Break pointer connection Re-connect the pointers
28
Insertion Description
Step 1 Step 2 Step 3 Step 4
29
Outline Introduction Insertion Description Deletion Description
Basic Node Implementation Conclusion
30
Deletion Description Deleting from the top of the list
Deleting from the end of the list Deleting from the middle of the list
31
Deletion Description Deleting from the top of the list
Deleting from the end of the list Deleting from the middle of the list
32
Deleting from the top Steps Break the pointer connection
Re-connect the nodes Delete the node
33
Deletion Description head 6 42 4 17 head 6 42 4 17 head 42 4 17
34
Deletion Description Deleting from the top of the list
Deleting from the end of the list Deleting from the middle of the list
35
Deleting from the end Steps Break the pointer connection
Set previous node pointer to NULL Delete the node
36
Deletion Description head 6 42 4 17 head 6 42 4 17 head 6 4 17
37
Deletion Description Deleting from the top of the list
Deleting from the end of the list Deleting from the middle of the list
38
Deleting from the Middle
Steps Set previous Node pointer to next node Break Node pointer connection Delete the node
39
Deletion Description head 42 4 17 head 42 4 17 head 42 4
40
Outline Introduction Insertion Description Deletion Description
Basic Node Implementation Conclusion
41
Basic Node Implementation
The following code is written in C++: Struct Node { int data; //any type of data could be another struct Node *next; //this is an important piece of code “pointer” };
42
Outline Introduction Insertion Description Deletion Description
Basic Node Implementation Conclusion
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.