Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

Write a java program to merge three singly linked list elements

public class Main{ Node head; static class Node { int data; Node next; Node(int d) {data = d;next=null; } } public void display() { Node n = head; while (n != null) { System.out.print(n.data+" 
"); n = n.next; } } public static void main(String[] args) { Main Main = new Main(); Main.head = new Node(10); Node second = new Node(15); Node third = new Node(20); Main.head.next = second; second.next = third; Main.display(); } }
Source by inlarn.com #
 
PREVIOUS NEXT
Tagged: #Write #java #program #merge #singly #linked #list #elements
ADD COMMENT
Topic
Name
4+6 =