Javatpoint Logo
Javatpoint Logo

singly Linked List

Program to create and display singly Linked List.

C Program

Output:

100 
 200 
 300 

Java Program

Output:

100 
 200 
 300 

Python Program

Output:

100 
 200 
 300 

PHP Program

Output:

100 
 200 
 300 

Explanation

Linked List is a type of data structure in which information is stored in the form of a node which consists of data and address of next node. In a linked list, the node represents a single element.

Pictorial representation of a node:-

singly Linked List

Representation of a node programmatically:-

C
Java
Python
Php

By using the above syntax of creating a node in each language. A linked list is created by creating each node object and giving some value to the data section of the node and linking to the next node by using the next pointer.

Steps to create a linked list by using node:-

1. Firstly we will create an object of the node and initialize them. Each object represents the single node.

C
Java
Python
Php

2. Finally, link nodes to each other. If there is no any next node to link, Next variable of node class will be initialized as null;

C
Java
Python
Php

Next TopicPrograms List




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials