Posts

Showing posts with the label Linked List

Linked List

Image
What is linked list? A collection of nodes, each node contains two parts, an data part and an link part. Data part:- data part of a linked list contains the data to be stored in linked list. Link part:- which contains the address of the next node. In the case of the current node is only node in the list or current node is last node in the list then address part contains NULL value in it. Such a linked allocation based structure is called Linked list. Types of linked list:- There are 3 types of linked list. 1. Single Linked List (SLL). 2. Circular Linked List (CLL). 3. Double Linked List (DLL). Some basic algorithms: 1.Design an algorithm to insert an element 'e' into a single linked list (SLL). So that the inserted element becomes first in the list. Algorithm:- Insert_First_SLL. Input:- F, address of first node of SLL.             e, element to be inserted. Output:- F, updated. Method:-      n = CreateNode();      n.data = e; ...