linked list operations in data structures

mahaperumal89 433 views 16 slides Jul 08, 2019
Slide 1
Slide 1 of 16
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16

About This Presentation

In detail operations in linked list has been shared here


Slide Content

தரவகடடடமமபடப
|
இமணகடகபடபடடட

வரரமசயரனடதரவகமளஉளடளளடமடமமறகளட

பப.மககலடடசமர

Data Structures |
Linked List

Data Structures -
Linked List insertion
operations
Mahalakshmi P

Insert node at the beginning of Singly
Linked List
●Steps to insert a new node at the start of a singly
linked list.

Create a new node, say newNode points to the newly
created node.

Link the newly created node with the head node, i.e.
the newNode will now point to head node.

Make the new node as the head node, i.e. now head
node will point to newNode.

Insert node at the end of Singly
Linked List

Steps to insert node at the end of Singly
linked list

●Create a new node and make sure that the address
part of the new node points to NULL i.e. newNode-
>next=NULL

●Traverse to the last node of the linked list and connect
the last node of the list with the new node, i.e. last
node will now point to new node. (lastNode->next =
newNode).

Insert node at the middle of Singly
Linked List

●Steps to insert node at the middle of Singly Linked
List

●Create a new node.

●Traverse to the n-1th position of the linked list and
connect the new node with the n+1th node. Means the
new node should also point to the same node that the
n-1th node is pointing to. (newNode->next = temp-
>next where temp is the n-1th node).

●Now at last connect the n-1th node with the new node
i.e. the n-1th node will now point to new node. (temp-
>next = newNode where temp is the n-1th node).

Reference
●https://codeforwin.org/2015/09/c-program-to-insert-n
ode-at-middle-of-singly-linked-list.html
●http://btechsmartclass.com/data_structures/single-
linked-list.html