Introduction to linked list : C Programming

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

  1. It is a data Structure which consists if group of nodes that forms a sequence.
  2. It is very common data structure that is used to create tree,graph and other abstract data types.

Basic Node Strucutre in Linked List

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

  1. Linked List is Series of Nodes
  2. Each node Consist of two Parts viz Data Part & Pointer Part
  3. Pointer Part stores the address of the next node

Linked List Basic Structure in Programming

What is linked list Node ?

  1. Each Linked List Consists of Series of Nodes
  2. In above Diagram , Linked List Consists of three nodes A,B,C etc
  3. 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)

Addres and Linked List Node Strucutre in Programming

Linked list Blocks

Linked list is created using following elements –

No Element Explanation
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.

linked list real life example

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