function to print the linked list
static void printList ( Node head ) { if ( head == null ) return ; while ( head . next != null ) { System . out . print ( head . data + " ▁ - > ▁ " ) ; head = head . next ; } System . out . println ( head . data ) ; }