SlideShare a Scribd company logo
DATA STRUCTURE 
ASSIGNMENT - I 
SINGLE LINKED LIST 
IMPLEMENTATION 
-BY 
B.ABDUL KALAM ASHAD 
B.ANISH KUMAR 
MOHAN RAJ 
D.SAPTHAGIRINATHAN 
SUDHARSHAN
SINGLE LINKED LIST 
Linked list is a collection of similar elements. 
Each elements points to the next element. 
Linked list is a linear list of specially designed 
nodes, where each node divided into two parts. 
INFO FIELD NEXT FIELD
 Info field: it contains necessary information 
about the items of the list to be stored and 
processed. 
Next field: it contains address of the next 
node. This field is used to access the next data 
item in other 
head 48 17 142
REPRESENTATION OF LINKED LIST 
1. Static or sequential or array representation. 
The linked list will be maintained or represented by two 
parallel arrays of same sizes. One array for the actual data item 
is called info field of the node and the other array for the 
address called the next field of the nodes. 
Info Next 
28 
1 
8 
2 
24 
-1 
28 8 24
2. Dynamic or pointers or linked representation. 
The size of the linked list may increase or decrease according 
to the requirement of application so dynamic representation of linked 
list do not have limitation and use space proportional to the actual 
number of elements of the list. 
Features: 
It wants ultimate size of the linked list to declare in advance. 
Array implementation of the linked list is very simple and 
efficient in random access of the elements.
OPERATION ON SINGLE LINKED LIST 
Creating linked list: 
To create a linked list we have to maintain the list of free 
nodes in array implementation. 
Initially all the nodes are empty and link to one another in 
sequence. 
The next field of the last node contains -1 to indicate the end 
of the list. 
Example: 
Free=0; 
For(i=0;i<size;i++) 
List [i].next=i+1; 
list[i].next= -1;
Traversing a linked list: 
This operation is used to visit each one of the list exactly 
once in order to access the info stored in nodes. 
Algorithm: 
1: if start=null 
a: print “list is empty” 
b: exit 
End if. 
2: Set ptr = start 
3: Repeat steps 4 and 5 until ptr! =null 
4: access and apply ptr info. 
5: set ptr= ptr next 
End repeat 
6: Exit
Insertion of an element into the linked list at various positions: 
Insertion of node into a linked list requires a free node in 
which the information can be inserted and then the node can be 
inserted into the linked list. 
Before header or at beginning. 
At the end of list. 
At the specified position.
Insertion at beginning 
head 48 17 142 // 
• Follow the previous steps and we get 
Step 1 Step 2 
head 93 
Step 3
Insertion At end 
head 48 17 142 // 
• Follow the previous steps and we get 
93 
Step 1 Step 2 
Step 3 
head 48 17 142 //
Insertion at the specified position 
To insert a new node at the specified position we have to 
search position in the list. 
Then we can insert the node after the position. Let the 
address of the specified node be kept in ptr. 
Adjust the pointer so that next pointer so that next pointer of 
the specified node pointed by the ptr. 
The next pointer of the specified node will point to the next 
pointer of the node pointed by new ptr.
Insertion at the specified position 
head 48 17 142 // 
• Follow the previous steps and we get 
Step 1 Step 2 
head 48 17 142 //
Deletion an element from the linked list 
If the node be deleted, that element should be search all 
over the list still the node find. Then it should be deleted. 
As like as insertion the deletion is also performed in three ways. 
Deletion at the beginning position of the linked list. 
Deletion at the ending position of linked list. 
Deletion at a specified position in linked list.
Deletion at beginning 
head 93 
• Follow the steps and we get 
Step 1 
Step 2 
head 48 17 142 //
Deletion At end 
head 48 17 142 // 
• Follow the steps and we get 
93 
Step 1 
Step 2 
head 48 17 142 //
Deletion at the specified position 
head 48 17 142 // 
• Follow the steps and we get 
Step 1 
Step 2 
head 48 17 142 //
ALGORITHM 
1. If start =NULL 
2. Print”over flow” 
3. Return 
4. End if 
5. Set ptr=start 
6. Assign value=startinfo 
7. Set start=startnext(second node becomes the first node). 
8. Release the node pointed by ptr to the memory heap. 
9. Exit.
single linked list

More Related Content

What's hot

Linked list implementation of Queue
Linked list implementation of QueueLinked list implementation of Queue
Linked list implementation of Queue
Dr. Sindhia Lingaswamy
 
Data Structures with C Linked List
Data Structures with C Linked ListData Structures with C Linked List
Data Structures with C Linked List
Reazul Islam
 
PPT On Sorting And Searching Concepts In Data Structure | In Programming Lang...
PPT On Sorting And Searching Concepts In Data Structure | In Programming Lang...PPT On Sorting And Searching Concepts In Data Structure | In Programming Lang...
PPT On Sorting And Searching Concepts In Data Structure | In Programming Lang...
Umesh Kumar
 
Linked list
Linked listLinked list
Linked list
akshat360
 
Linear data structure concepts
Linear data structure conceptsLinear data structure concepts
Linear data structure concepts
Akila Krishnamoorthy
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure
shameen khan
 
Binary Search Tree
Binary Search TreeBinary Search Tree
Binary Search Tree
sagar yadav
 
Data structures using c
Data structures using cData structures using c
Data structures using c
Prof. Dr. K. Adisesha
 
Linked List - Insertion & Deletion
Linked List - Insertion & DeletionLinked List - Insertion & Deletion
Linked List - Insertion & Deletion
Afaq Mansoor Khan
 
Queue in Data Structure
Queue in Data Structure Queue in Data Structure
Queue in Data Structure
Janki Shah
 
Stacks IN DATA STRUCTURES
Stacks IN DATA STRUCTURESStacks IN DATA STRUCTURES
Stacks IN DATA STRUCTURES
Sowmya Jyothi
 
Data Structure and Algorithms Linked List
Data Structure and Algorithms Linked ListData Structure and Algorithms Linked List
Data Structure and Algorithms Linked List
ManishPrajapati78
 
1.1 binary tree
1.1 binary tree1.1 binary tree
1.1 binary tree
Krish_ver2
 
Binary search
Binary searchBinary search
Binary search
AparnaKumari31
 
Linklist
LinklistLinklist
Data Structures- Part5 recursion
Data Structures- Part5 recursionData Structures- Part5 recursion
Data Structures- Part5 recursion
Abdullah Al-hazmy
 
Data Structures - Lecture 9 [Stack & Queue using Linked List]
 Data Structures - Lecture 9 [Stack & Queue using Linked List] Data Structures - Lecture 9 [Stack & Queue using Linked List]
Data Structures - Lecture 9 [Stack & Queue using Linked List]
Muhammad Hammad Waseem
 
Arrays
ArraysArrays
Insertion sort
Insertion sort Insertion sort
Insertion sort
Monalisa Patel
 
Sorting
SortingSorting

What's hot (20)

Linked list implementation of Queue
Linked list implementation of QueueLinked list implementation of Queue
Linked list implementation of Queue
 
Data Structures with C Linked List
Data Structures with C Linked ListData Structures with C Linked List
Data Structures with C Linked List
 
PPT On Sorting And Searching Concepts In Data Structure | In Programming Lang...
PPT On Sorting And Searching Concepts In Data Structure | In Programming Lang...PPT On Sorting And Searching Concepts In Data Structure | In Programming Lang...
PPT On Sorting And Searching Concepts In Data Structure | In Programming Lang...
 
Linked list
Linked listLinked list
Linked list
 
Linear data structure concepts
Linear data structure conceptsLinear data structure concepts
Linear data structure concepts
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure
 
Binary Search Tree
Binary Search TreeBinary Search Tree
Binary Search Tree
 
Data structures using c
Data structures using cData structures using c
Data structures using c
 
Linked List - Insertion & Deletion
Linked List - Insertion & DeletionLinked List - Insertion & Deletion
Linked List - Insertion & Deletion
 
Queue in Data Structure
Queue in Data Structure Queue in Data Structure
Queue in Data Structure
 
Stacks IN DATA STRUCTURES
Stacks IN DATA STRUCTURESStacks IN DATA STRUCTURES
Stacks IN DATA STRUCTURES
 
Data Structure and Algorithms Linked List
Data Structure and Algorithms Linked ListData Structure and Algorithms Linked List
Data Structure and Algorithms Linked List
 
1.1 binary tree
1.1 binary tree1.1 binary tree
1.1 binary tree
 
Binary search
Binary searchBinary search
Binary search
 
Linklist
LinklistLinklist
Linklist
 
Data Structures- Part5 recursion
Data Structures- Part5 recursionData Structures- Part5 recursion
Data Structures- Part5 recursion
 
Data Structures - Lecture 9 [Stack & Queue using Linked List]
 Data Structures - Lecture 9 [Stack & Queue using Linked List] Data Structures - Lecture 9 [Stack & Queue using Linked List]
Data Structures - Lecture 9 [Stack & Queue using Linked List]
 
Arrays
ArraysArrays
Arrays
 
Insertion sort
Insertion sort Insertion sort
Insertion sort
 
Sorting
SortingSorting
Sorting
 

Viewers also liked

Single linked list
Single linked listSingle linked list
Single linked list
Sayantan Sur
 
01 ds and algorithm session_01
01 ds and algorithm session_0101 ds and algorithm session_01
01 ds and algorithm session_01Niit Care
 
Doublylinklist
DoublylinklistDoublylinklist
Doublylinklistritu1806
 
Stack and queue
Stack and queueStack and queue
Stack and queue
Katang Isip
 
Method overloading
Method overloadingMethod overloading
Method overloading
Lovely Professional University
 
Data structures
Data structuresData structures
Loaders
LoadersLoaders
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
Julie Iskander
 
Introduction to loaders
Introduction to loadersIntroduction to loaders
Introduction to loadersTech_MX
 

Viewers also liked (10)

Single linked list
Single linked listSingle linked list
Single linked list
 
01 ds and algorithm session_01
01 ds and algorithm session_0101 ds and algorithm session_01
01 ds and algorithm session_01
 
Doublylinklist
DoublylinklistDoublylinklist
Doublylinklist
 
Stack and queue
Stack and queueStack and queue
Stack and queue
 
circular linked list
circular linked listcircular linked list
circular linked list
 
Method overloading
Method overloadingMethod overloading
Method overloading
 
Data structures
Data structuresData structures
Data structures
 
Loaders
LoadersLoaders
Loaders
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
 
Introduction to loaders
Introduction to loadersIntroduction to loaders
Introduction to loaders
 

Similar to single linked list

Linked list and its operations - Traversal
Linked list and its operations - TraversalLinked list and its operations - Traversal
Linked list and its operations - Traversal
kasthurimukila
 
Linked lists a
Linked lists aLinked lists a
Linked lists a
Khuram Shahzad
 
DS_LinkedList.pptx
DS_LinkedList.pptxDS_LinkedList.pptx
DS_LinkedList.pptx
msohail37
 
Linked list.docx
Linked list.docxLinked list.docx
Linked list.docx
EmilyMengich
 
Dounly linked list
Dounly linked listDounly linked list
Dounly linked list
NirmalPandey23
 
Operations on linked list
Operations on linked listOperations on linked list
Operations on linked list
Sumathi Kv
 
Linked list
Linked listLinked list
Linked list
James Wong
 
Linked list
Linked listLinked list
Linked list
Hoang Nguyen
 
Linked list
Linked listLinked list
Linked list
Fraboni Ec
 
1.3 Linked List.pptx
1.3 Linked List.pptx1.3 Linked List.pptx
1.3 Linked List.pptx
ssuserd2f031
 
VCE Unit 02 (1).pptx
VCE Unit 02 (1).pptxVCE Unit 02 (1).pptx
VCE Unit 02 (1).pptx
skilljiolms
 
Unit ii(dsc++)
Unit ii(dsc++)Unit ii(dsc++)
Unit ii(dsc++)
Durga Devi
 
DSA chapter 4.pptxhdjaaaaaadjhsssssssssssssssssssssssssss
DSA chapter 4.pptxhdjaaaaaadjhsssssssssssssssssssssssssssDSA chapter 4.pptxhdjaaaaaadjhsssssssssssssssssssssssssss
DSA chapter 4.pptxhdjaaaaaadjhsssssssssssssssssssssssssss
beshahashenafe20
 
Linked list (1).pptx
Linked list (1).pptxLinked list (1).pptx
Linked list (1).pptx
rajveersingh643731
 

Similar to single linked list (20)

Linked list and its operations - Traversal
Linked list and its operations - TraversalLinked list and its operations - Traversal
Linked list and its operations - Traversal
 
Algo>ADT list & linked list
Algo>ADT list & linked listAlgo>ADT list & linked list
Algo>ADT list & linked list
 
Linked lists a
Linked lists aLinked lists a
Linked lists a
 
DS_LinkedList.pptx
DS_LinkedList.pptxDS_LinkedList.pptx
DS_LinkedList.pptx
 
Link list assi
Link list assiLink list assi
Link list assi
 
Linked list.docx
Linked list.docxLinked list.docx
Linked list.docx
 
Dounly linked list
Dounly linked listDounly linked list
Dounly linked list
 
Operations on linked list
Operations on linked listOperations on linked list
Operations on linked list
 
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
 
Linked list
Linked listLinked list
Linked list
 
Linked list
Linked listLinked list
Linked list
 
Linked list
Linked listLinked list
Linked list
 
1.3 Linked List.pptx
1.3 Linked List.pptx1.3 Linked List.pptx
1.3 Linked List.pptx
 
VCE Unit 02 (1).pptx
VCE Unit 02 (1).pptxVCE Unit 02 (1).pptx
VCE Unit 02 (1).pptx
 
Unit ii(dsc++)
Unit ii(dsc++)Unit ii(dsc++)
Unit ii(dsc++)
 
DSA chapter 4.pptxhdjaaaaaadjhsssssssssssssssssssssssssss
DSA chapter 4.pptxhdjaaaaaadjhsssssssssssssssssssssssssssDSA chapter 4.pptxhdjaaaaaadjhsssssssssssssssssssssssssss
DSA chapter 4.pptxhdjaaaaaadjhsssssssssssssssssssssssssss
 
Linked list (1).pptx
Linked list (1).pptxLinked list (1).pptx
Linked list (1).pptx
 

More from Sathasivam Rangasamy (10)

deque and it applications
deque and it applicationsdeque and it applications
deque and it applications
 
Team 2
Team 2Team 2
Team 2
 
Team 1
Team 1Team 1
Team 1
 
Team 10
Team 10Team 10
Team 10
 
Team 9
Team 9Team 9
Team 9
 
linkedlist
linkedlistlinkedlist
linkedlist
 
Team 6
Team 6Team 6
Team 6
 
Team 5
Team 5Team 5
Team 5
 
Team 4
Team 4Team 4
Team 4
 
Team 3
Team 3Team 3
Team 3
 

single linked list

  • 1. DATA STRUCTURE ASSIGNMENT - I SINGLE LINKED LIST IMPLEMENTATION -BY B.ABDUL KALAM ASHAD B.ANISH KUMAR MOHAN RAJ D.SAPTHAGIRINATHAN SUDHARSHAN
  • 2. SINGLE LINKED LIST Linked list is a collection of similar elements. Each elements points to the next element. Linked list is a linear list of specially designed nodes, where each node divided into two parts. INFO FIELD NEXT FIELD
  • 3.  Info field: it contains necessary information about the items of the list to be stored and processed. Next field: it contains address of the next node. This field is used to access the next data item in other head 48 17 142
  • 4. REPRESENTATION OF LINKED LIST 1. Static or sequential or array representation. The linked list will be maintained or represented by two parallel arrays of same sizes. One array for the actual data item is called info field of the node and the other array for the address called the next field of the nodes. Info Next 28 1 8 2 24 -1 28 8 24
  • 5. 2. Dynamic or pointers or linked representation. The size of the linked list may increase or decrease according to the requirement of application so dynamic representation of linked list do not have limitation and use space proportional to the actual number of elements of the list. Features: It wants ultimate size of the linked list to declare in advance. Array implementation of the linked list is very simple and efficient in random access of the elements.
  • 6. OPERATION ON SINGLE LINKED LIST Creating linked list: To create a linked list we have to maintain the list of free nodes in array implementation. Initially all the nodes are empty and link to one another in sequence. The next field of the last node contains -1 to indicate the end of the list. Example: Free=0; For(i=0;i<size;i++) List [i].next=i+1; list[i].next= -1;
  • 7. Traversing a linked list: This operation is used to visit each one of the list exactly once in order to access the info stored in nodes. Algorithm: 1: if start=null a: print “list is empty” b: exit End if. 2: Set ptr = start 3: Repeat steps 4 and 5 until ptr! =null 4: access and apply ptr info. 5: set ptr= ptr next End repeat 6: Exit
  • 8. Insertion of an element into the linked list at various positions: Insertion of node into a linked list requires a free node in which the information can be inserted and then the node can be inserted into the linked list. Before header or at beginning. At the end of list. At the specified position.
  • 9. Insertion at beginning head 48 17 142 // • Follow the previous steps and we get Step 1 Step 2 head 93 Step 3
  • 10. Insertion At end head 48 17 142 // • Follow the previous steps and we get 93 Step 1 Step 2 Step 3 head 48 17 142 //
  • 11. Insertion at the specified position To insert a new node at the specified position we have to search position in the list. Then we can insert the node after the position. Let the address of the specified node be kept in ptr. Adjust the pointer so that next pointer so that next pointer of the specified node pointed by the ptr. The next pointer of the specified node will point to the next pointer of the node pointed by new ptr.
  • 12. Insertion at the specified position head 48 17 142 // • Follow the previous steps and we get Step 1 Step 2 head 48 17 142 //
  • 13. Deletion an element from the linked list If the node be deleted, that element should be search all over the list still the node find. Then it should be deleted. As like as insertion the deletion is also performed in three ways. Deletion at the beginning position of the linked list. Deletion at the ending position of linked list. Deletion at a specified position in linked list.
  • 14. Deletion at beginning head 93 • Follow the steps and we get Step 1 Step 2 head 48 17 142 //
  • 15. Deletion At end head 48 17 142 // • Follow the steps and we get 93 Step 1 Step 2 head 48 17 142 //
  • 16. Deletion at the specified position head 48 17 142 // • Follow the steps and we get Step 1 Step 2 head 48 17 142 //
  • 17. ALGORITHM 1. If start =NULL 2. Print”over flow” 3. Return 4. End if 5. Set ptr=start 6. Assign value=startinfo 7. Set start=startnext(second node becomes the first node). 8. Release the node pointed by ptr to the memory heap. 9. Exit.