Program to to Merge Two sorted Linked lists in Java
package programs; import ds.linkedlists.*; //Linkedlist and Node are my internal classes which I mentioned in LinkedList Program public class Merge2SortedLL { public static void main(String[] args) { LinkedList l1 = new LinkedList(); LinkedList l2 = new LinkedList(); l1.Enqueue(4); l1.Enqueue(5); l1.Enqueue(7); l1.Enqueue(11); l1.Enqueue(12); l2.Enqueue(3); l2.Enqueue(4); l2.Enqueue(7); l2.Enqueue(18); l2.Enqueue(20); l1.head = Merge(l1,l2); l1.display(); } private static LLNode Merge(LinkedList l1, LinkedList l2) { LLNode t1= l1.head; LLNode t2= l2.head; LLNode head = null; LLNode prev = null; while(t1!=null && t2 != null){ if(head == null){ if(t1.value >t2.value){ prev = t2; t2 = t2.next; } else { prev= t1; t1 = t1.next; } head= prev; } else{ if(t1.value >t2.value){ prev.next = t2; prev = t2; t2 = t2.next; ...