Skip to content

Instantly share code, notes, and snippets.

@vin18
Created July 10, 2020 11:56
Show Gist options
  • Save vin18/045646505597e094bcecd03b807c9c03 to your computer and use it in GitHub Desktop.
Save vin18/045646505597e094bcecd03b807c9c03 to your computer and use it in GitHub Desktop.
// Function to print a linked list
public static void printList(Node<Integer> head) {
if (head == null) {
return;
}
while (head != null) {
System.out.println(head.data);
head = head.next;
}
}
// Time Complexity: O(N)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment