Linked List:-
Linked List is a linear data structure. It is a collection of records, and all the records are connected by a variable which holds a memory address.
When you create a list, you write items one after the other. Similarly, a linked item is also added after a data item in the linked list.It is a collection of records, and all the records are connected by a variable which holds a memory address. Each record in a linked list has a field that is a pointer pointing to next record in the list.
Read Also:
Pointer variable is used to point to the first record in the list. You can think of a linked list as a tree. All the branches of a tree are connected among themselves. You can move from one branch to another. All the data items are connected to a linked list like tree.
It is a complex data structure, especially useful in systems or applications programming. It is comprised of a series of nodes, each node containing a data element, and a pointer to the next node, as like below pic.When you create a list, you write items one after the other. Similarly, a linked item is also added after a data item in the linked list.It is a collection of records, and all the records are connected by a variable which holds a memory address. Each record in a linked list has a field that is a pointer pointing to next record in the list.
Read Also:
Pointer variable is used to point to the first record in the list. You can think of a linked list as a tree. All the branches of a tree are connected among themselves. You can move from one branch to another. All the data items are connected to a linked list like tree.
It is the self-referential structure. It allows us to have a chain of structure with related data.
The flowchart of a linked list is showing below:
It is not necessary to know the number of elements and allocate memory for them beforehand. Memory can be allocated as and when necessary. In case the size of the structure and the data in the structure are constantly changing then the array is not a useful structure and hence linked list is used. In a linked list, insertions and deletions can be handled efficiently without having to restructure the list.
Types of linked list:-
There are various types of linked lists which are following:
0 Comments