Introduction to linked list : C ProgrammingPritesh
We are learning this topic using c programming. Linked list is a type of data structure provided in C language to make use of pointer efficiently.
Introduction to Linked List
- It is a data Structure which consists if group of nodes that forms a sequence.
- It is very common data structure that is used to create tree,graph and other abstract data types.
Linked list comprise of group or list of nodes in which each node have link to next node to form a chain
Linked List definition
- Linked List is Series of Nodes
- Each node Consist of two Parts viz Data Part & Pointer Part
- Pointer Part stores the address of the next node
What is linked list Node ?
- Each Linked List Consists of Series of Nodes
- In above Diagram , Linked List Consists of three nodes A,B,C etc
- Node A has two part one data part which consists of the 5 as data and the second part which contain the address of the next node (i.e it contain the address of the next node)
Linked list Blocks
Linked list is created using following elements –
|1||Node||Linked list is collection of number of nodes|
|2||Address Field in Node||Address field in node is used to keep address of next node|
|3||Data Field in Node||Data field in node is used to hold data inside linked list.|
We can represent linked list in real life using train in which all the buggies are nodes and two coaches are connected using the connectors.
In case of railway we have peoples seating arrangement inside the coaches is called as data part of lined list while connection between two buggies is address filed of linked list.
Like linked list, trains also have last coach which is not further connected to any of the buggie. Engine can be called as first node of linked list