Function which returns new linked list
static Node newList ( Node root1 , Node root2 ) { Node ptr1 = root1 , ptr2 = root2 , ptr ; Node root = null , temp ; while ( ptr1 != null ) { temp = new Node ( ) ; temp . next = null ;