## A linked list is a list type data structure that contains a collection of data elements where the order of physical arrangement (memory allocated) is not continuous i.e. unlike in an array where the physical arrangement (memory allocated) is continuous.

In the linked list, each data element is represented by a node
A typical representation of a node of a singly linked list (explained below) is given below.

Hence we can represent a linked list as a collection of such nodes.

### Types of Linked List :

A singly linked is a list where each node except the last has the address of its next
node and last node points to NULL.

We can implement a linked list with the help of structures(keyword struct) or a
class with a pointer (head) of the type that is of the node, which stores the link (address) to the starting of the list which is then iterated till we reach the node with Null.

### Operations in a singly linked list

1. Traversal:
we travel through each element linearly to reach any node. We have to traverse all the nodes before it until and unless we have the address of that node.
Search and traversal operation takes O(n)

2. Insertion at any point :
To insert a node X between A1 and A2, we need to traverse till A1,
X.next = A1.next
A1.next = X

3. Deletion at any point :
To delete a node A2, we need to traverse till A1
A1.next = A2.next
free(A2)

• Video Explanation:

### Hand simulation of the code:

Hoping that you understood singly Linked List, here are some problems for you:

### BASICS Problems :

1. Print the elements of the linked list
2. Insert a node at the tail of a linked list
3. Insert a node at a specific position
4. Delete a node