A linked list is a type of linear data structure that include a series of inter connected nodes. The elements in Linked list are not stored at an adjacent location and they linked using pointers.

Basically, a linked list is a sequence of data structures, that are connected with one another via links.

A linked list is a sequence of links that contain items. Each link includes a connection to another link. The Linked list is the next most-used data structure following the array.

Arrays can be used to store linear data of similar types, but arrays have the following limitations.
1) The array size is fixed: We must know in advance the upper limit on the number of elements.
2) Inserting a new element in an array of elements is expensive in terms of time consumption. This is because the room has to be built for the new elements and all the following elements have to be shifted.

A linked list is a random sequence of data structures, which are connected together via links and contain items. Each link of the element contains a connection to another link.

Following are the important terms in Linked List Data Structures:

Representation:
A linked list is represented by a pointer to the first node of the linked list. The first node is called the head. If the linked list is empty, then the value of the head is NULL.
Each node in a list consists of at least two parts:
1) data
2) Pointer (Or Reference) to the next node

Following are the various types of linked list.

• Doubly Linked List − Items can be navigated forward and backward.
• Circular Linked List − Last item contains link of the first element as next and the first element has a link to the last element as previous.

Time Complexity

• Dynamic memory allocation
• Hash tables, Graphs
• Implemented in stack and queue
• In undoing functionality of the software

## Basic Operations

Following are the basic operations supported by a list.

• Insertion − Appends an element at the beginning of the list.
• Deletion − Removes an element at the beginning of the list.
• Display − Presents the complete list.
• Search − Examines an element using the given key.
• Delete − Destroys an element using the given key.

1) Dynamic size
2) Ease of insertion/deletion

Drawbacks:
1) Random access is not possible: We have to access elements starting from the first node of the list. So we cannot do a binary search with linked lists efficiently with its default implementation.
2) Additional memory space to hold a pointer is needed with each element of the list.
3) Not cache-friendly. Since array components are contiguous locations, there is the locality of reference which is not present in the case of linked lists.

SYNTAX:

``````#include <bits/stdc++.h>

using namespace std;
int main()
{

class Node
{
public:
int data;
Node * next;
};
}``````

We will be happy to hear your thoughts
Hello!👋