LINKED LIST
Singly linked list or just called linked list could be a linear arrangement consisting of elements called nodes where each node consists of two parts: information part and a link part also called the subsequent pointer part, the data part contains user supplied data and therefore the link part which could be a pointer data that points to the following node within the linked list. The link a part of the last node is ready to NULL that marks the end of the list.
LINKED LIST V/S ARRAYS
The data structure that linked list compete directly with is the array. Each data structure has its own strengths and weakness. So the choice of a particular data structure depends upon the requirement of problem. Linked list is frequently used in those situations where a large number of insertions and deletion need to be performed and number of data elements may be unpredictable.
OPERATIONS ON LINKED LIST
- TRAVERSING:- Traversing involves garbling each node of the linked list exactly once from the beginning to the end following the chain of references. Let us consider a linked list LIST stored in memory with pointer HEAD pointing to the first node and NULL pointing to the first node and NULL indicating the end of the list.
- SEARCHING:- Searching is one of the elementary operation of the linked list. It is the process of finding the location of the node holding the desired item in the linked list. Search is reviewed successful if the node containing the item is found and unsuccessful otherwise.
- INSERTION:- Insertion is amidst the most frequent operation performed on the linked list. In a sorted list, nodes are maintained in a sequence according to the data, may be in ascending or descending order. In a sorted list, the nodes are arranged at random i.e. no sequence order among nodes is maintained.
- DELETION:- Deletion is another recurrent operation performed on the linked list. The delete operation analytic removes a node from the linked list by changing various link pointers. Once a node is deleted, the space is taken by the node in the linked list must be recovered and added to the free storage list. In order to analytic delete a node, it is important to first locate the target node(node to be deleted). However, to delete a node, we not only requires a pointer pointing to its predecessor. This is because once we delete the target node there is no way to recombine its predecessor to the successor due to forward chaining property of the singly linked list.
- SORTING:- This is to done that to arrange the elements of a list in a particular order.