Linked List
Linked List (Introduction)
A linked list is a linear data structure, in which the elements are linked using pointers. Each linked list consists of two parts.
- data
- address
Pros and cons of using linked lists
- a linked list is dynamic in nature, which allocates memory when needed.
- Insertion and removal operations can be easily carried out but
- The memory is wasted as pointers require extra memory for storage.
- In the linked list elements cannot be accessed randomly.
Types of linked list:
There are three types of linked lists.
- Singly linked list.
- Doubly linked list.
- Circular doubly linked list.
Singly linked list:
A singly linked list consists of two parts one is the data part and the other one is the pointer that contains the address of the next part.
Doubly linked list:
A singly linked list consists of three parts one data part and two pointers one pointing to the next node's address while the other one pointing to the previous node's address.
In a circular linked list, all the nodes are connected to form a circle. There is no NULL at the end. A circular linked list can be a doubly circular linked list or a singly circular linked list.
Comments
Post a Comment
feel free to contact me in case of queries