/*
Print elements of a linked list on console
head pointer input could be NULL as well for empty list
Node is defined as
class Node {
int data;
Node next;
}
*/
// This is a "method-only" submission.
// You only need to complete this method.
void Print(Node head) {
if(head == null || head.next == null){
return;
}else{
Node temp = head;
while(temp != null){
System.out.println(temp.data);
temp = temp.next;
}
}
}
Created
June 19, 2016 08:55
-
-
Save igaozp/e12c3267015622b33c6ce00289fb463d to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment