Function to insert node in a linked list
struct Node * create ( struct Node * head , int x ) { struct Node * temp , * ptr = head ; temp = new Node ( ) ; temp -> data = x ; temp -> next = NULL ; if ( head == NULL ) head = temp ; else { while ( ptr -> next != NULL ) { ptr = ptr -> next ; } ptr -> next = temp ; } return head ; }