SlideShare a Scribd company logo
1 of 8
Download to read offline
LINKED LIST
LINKED LIST
• The name LINKED LIST itself depicts that list of elements are linked
together.
• Hence List is a ordered set of elements.
• The general form of the list is
OPERATIONS ON LIST
OPERATIONS DESCRIPTION
Insert ( X, P ) Insert the element X after the position P
Delete ( X ) The element X is deleted
Find ( X ) Returns the position of X
FindKth ( P ) Returns the elements in the specified position
Next ( P ) Returns the position of its successor element ( P + 1 )
Previous ( P ) Returns the position of its predecessor element ( P – 1 )
PrintList Contents of the list is printed
MakeEmpty Make the list as empty
EXAMPLE
• Consider the list of numbers like
5, 10, 15, 20, 25, 30, 35
which has position like 1 2 3 4 5 6 7
• Insert ( 100, 3 ) 5, 10, 15, 100, 20, 25, 30, 35
changes position like 1 2 3 4 5 6 7 8
The element 100 is inserted after the position 3
• Delete ( 20 ) 5, 10, 15, 100, 25, 30, 35
changes position like 1 2 3 4 5 6 7
The element 20 is deleted, and the following elements goes on shifting
to the previous positions.
EXAMPLE
• Find ( 10 ) 2
The position of the element 10 is returned
• Find Kth ( 6 ) 30
The element at the position 6 will be returned
• Next ( 1 ) 2
Now the position is P=1 so the successor element is P + 1 = 1 + 1 =2
• Previous ( 4 ) 3
Now the position is P=4 so the predecessor element is P - 1 = 4 - 1 =3
SIMPLE ARRAY IMPLEMENTATION OF LIST
• Array is a collection of similar data type stored in consecutive memory
location.
• All operations can be implemented just by using array.
• PrintList and Find operation takes linear time.
• Find Kth operation takes constant time.
ARRAY IMPLEMENTATION-- DISADVANTAGES
• Insertion and deletion is expensive.
• If we have to insert a number 5 at the position 1, then we have to push
the entire array down one spot to make room.
• Deleting the first elements requires shifting all the elements in the list.
ARRAY IMPLEMENTATION- DISADVANTAGES
• Size of the array is fixed. Upper limit must be known.
• Even if the array is dynamically allocated, an estimate of the
maximum size of the list is required which considerably wastes the
memory space.
• Running time for insertion and deletion is slow.

More Related Content

What's hot

What's hot (20)

Radix sort
Radix sortRadix sort
Radix sort
 
3.6 radix sort
3.6 radix sort3.6 radix sort
3.6 radix sort
 
Arrays Data Structure
Arrays Data StructureArrays Data Structure
Arrays Data Structure
 
Binary search
Binary search Binary search
Binary search
 
Sortsearch
SortsearchSortsearch
Sortsearch
 
Priority queue
Priority queuePriority queue
Priority queue
 
Nikit
NikitNikit
Nikit
 
Sorting Algorithms
Sorting AlgorithmsSorting Algorithms
Sorting Algorithms
 
Hashing Techniques in Data Structures Part2
Hashing Techniques in Data Structures Part2Hashing Techniques in Data Structures Part2
Hashing Techniques in Data Structures Part2
 
Radix Sort
Radix SortRadix Sort
Radix Sort
 
DATASTRUCTURES UNIT-1
DATASTRUCTURES UNIT-1DATASTRUCTURES UNIT-1
DATASTRUCTURES UNIT-1
 
Array operations
Array operationsArray operations
Array operations
 
Hash tables
Hash tablesHash tables
Hash tables
 
Hash table
Hash tableHash table
Hash table
 
Hashing notes data structures (HASHING AND HASH FUNCTIONS)
Hashing notes data structures (HASHING AND HASH FUNCTIONS)Hashing notes data structures (HASHING AND HASH FUNCTIONS)
Hashing notes data structures (HASHING AND HASH FUNCTIONS)
 
Data structures
Data structuresData structures
Data structures
 
Array 2
Array 2Array 2
Array 2
 
One to-one function (MATH 11)
One to-one function (MATH 11)One to-one function (MATH 11)
One to-one function (MATH 11)
 
COMPUTER PROGRAMMING UNIT 1 Lecture 5
COMPUTER PROGRAMMING UNIT 1 Lecture 5COMPUTER PROGRAMMING UNIT 1 Lecture 5
COMPUTER PROGRAMMING UNIT 1 Lecture 5
 
Hash function
Hash functionHash function
Hash function
 

Similar to Linked list

Stacks in DATA STRUCTURE
Stacks in DATA STRUCTUREStacks in DATA STRUCTURE
Stacks in DATA STRUCTUREMandeep Singh
 
GF_Python_Data_Structures.ppt
GF_Python_Data_Structures.pptGF_Python_Data_Structures.ppt
GF_Python_Data_Structures.pptManishPaul40
 
Data structure lecture7
Data structure lecture7Data structure lecture7
Data structure lecture7Kumar
 
Bsc cs ii dfs u-2 linklist,stack,queue
Bsc cs ii  dfs u-2 linklist,stack,queueBsc cs ii  dfs u-2 linklist,stack,queue
Bsc cs ii dfs u-2 linklist,stack,queueRai University
 
Mca ii dfs u-3 linklist,stack,queue
Mca ii dfs u-3 linklist,stack,queueMca ii dfs u-3 linklist,stack,queue
Mca ii dfs u-3 linklist,stack,queueRai University
 
Detalied information of queue
Detalied information of queueDetalied information of queue
Detalied information of queueSmit Parikh
 
358 33 powerpoint-slides_14-sorting_chapter-14
358 33 powerpoint-slides_14-sorting_chapter-14358 33 powerpoint-slides_14-sorting_chapter-14
358 33 powerpoint-slides_14-sorting_chapter-14sumitbardhan
 
Bca ii dfs u-2 linklist,stack,queue
Bca ii  dfs u-2 linklist,stack,queueBca ii  dfs u-2 linklist,stack,queue
Bca ii dfs u-2 linklist,stack,queueRai University
 
Data structures and Algorithm analysis_Lecture 2.pptx
Data structures and Algorithm analysis_Lecture 2.pptxData structures and Algorithm analysis_Lecture 2.pptx
Data structures and Algorithm analysis_Lecture 2.pptxAhmedEldesoky24
 

Similar to Linked list (20)

Stack q ll algo
Stack q ll algoStack q ll algo
Stack q ll algo
 
sorting1.pptx
sorting1.pptxsorting1.pptx
sorting1.pptx
 
Queue
QueueQueue
Queue
 
LEC4-DS ALGO.pdf
LEC4-DS  ALGO.pdfLEC4-DS  ALGO.pdf
LEC4-DS ALGO.pdf
 
Ds notes
Ds notesDs notes
Ds notes
 
Stacks in DATA STRUCTURE
Stacks in DATA STRUCTUREStacks in DATA STRUCTURE
Stacks in DATA STRUCTURE
 
GF_Python_Data_Structures.ppt
GF_Python_Data_Structures.pptGF_Python_Data_Structures.ppt
GF_Python_Data_Structures.ppt
 
LEC3-DS ALGO(updated).pdf
LEC3-DS  ALGO(updated).pdfLEC3-DS  ALGO(updated).pdf
LEC3-DS ALGO(updated).pdf
 
Data structure lecture7
Data structure lecture7Data structure lecture7
Data structure lecture7
 
Bsc cs ii dfs u-2 linklist,stack,queue
Bsc cs ii  dfs u-2 linklist,stack,queueBsc cs ii  dfs u-2 linklist,stack,queue
Bsc cs ii dfs u-2 linklist,stack,queue
 
Mca ii dfs u-3 linklist,stack,queue
Mca ii dfs u-3 linklist,stack,queueMca ii dfs u-3 linklist,stack,queue
Mca ii dfs u-3 linklist,stack,queue
 
Detalied information of queue
Detalied information of queueDetalied information of queue
Detalied information of queue
 
358 33 powerpoint-slides_14-sorting_chapter-14
358 33 powerpoint-slides_14-sorting_chapter-14358 33 powerpoint-slides_14-sorting_chapter-14
358 33 powerpoint-slides_14-sorting_chapter-14
 
Bca ii dfs u-2 linklist,stack,queue
Bca ii  dfs u-2 linklist,stack,queueBca ii  dfs u-2 linklist,stack,queue
Bca ii dfs u-2 linklist,stack,queue
 
Data structures and Algorithm analysis_Lecture 2.pptx
Data structures and Algorithm analysis_Lecture 2.pptxData structures and Algorithm analysis_Lecture 2.pptx
Data structures and Algorithm analysis_Lecture 2.pptx
 
Sorting
SortingSorting
Sorting
 
Linked list
Linked listLinked list
Linked list
 
Linked list
Linked listLinked list
Linked list
 
Linked list
Linked listLinked list
Linked list
 
Linked list
Linked listLinked list
Linked list
 

Recently uploaded

ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701bronxfugly43
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfChris Hunter
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIShubhangi Sonawane
 

Recently uploaded (20)

ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 

Linked list

  • 2. LINKED LIST • The name LINKED LIST itself depicts that list of elements are linked together. • Hence List is a ordered set of elements. • The general form of the list is
  • 3. OPERATIONS ON LIST OPERATIONS DESCRIPTION Insert ( X, P ) Insert the element X after the position P Delete ( X ) The element X is deleted Find ( X ) Returns the position of X FindKth ( P ) Returns the elements in the specified position Next ( P ) Returns the position of its successor element ( P + 1 ) Previous ( P ) Returns the position of its predecessor element ( P – 1 ) PrintList Contents of the list is printed MakeEmpty Make the list as empty
  • 4. EXAMPLE • Consider the list of numbers like 5, 10, 15, 20, 25, 30, 35 which has position like 1 2 3 4 5 6 7 • Insert ( 100, 3 ) 5, 10, 15, 100, 20, 25, 30, 35 changes position like 1 2 3 4 5 6 7 8 The element 100 is inserted after the position 3 • Delete ( 20 ) 5, 10, 15, 100, 25, 30, 35 changes position like 1 2 3 4 5 6 7 The element 20 is deleted, and the following elements goes on shifting to the previous positions.
  • 5. EXAMPLE • Find ( 10 ) 2 The position of the element 10 is returned • Find Kth ( 6 ) 30 The element at the position 6 will be returned • Next ( 1 ) 2 Now the position is P=1 so the successor element is P + 1 = 1 + 1 =2 • Previous ( 4 ) 3 Now the position is P=4 so the predecessor element is P - 1 = 4 - 1 =3
  • 6. SIMPLE ARRAY IMPLEMENTATION OF LIST • Array is a collection of similar data type stored in consecutive memory location. • All operations can be implemented just by using array. • PrintList and Find operation takes linear time. • Find Kth operation takes constant time.
  • 7. ARRAY IMPLEMENTATION-- DISADVANTAGES • Insertion and deletion is expensive. • If we have to insert a number 5 at the position 1, then we have to push the entire array down one spot to make room. • Deleting the first elements requires shifting all the elements in the list.
  • 8. ARRAY IMPLEMENTATION- DISADVANTAGES • Size of the array is fixed. Upper limit must be known. • Even if the array is dynamically allocated, an estimate of the maximum size of the list is required which considerably wastes the memory space. • Running time for insertion and deletion is slow.