A utility function to insert a new node at the beginning of doubly linked list
void insert ( struct Node * * head , int data ) { struct Node * temp = new Node ; temp -> data = data ; temp -> next = temp -> prev = NULL ; if ( ! ( * head ) ) ( * head ) = temp ; else { temp -> next = * head ; ( * head ) -> prev = temp ; ( * head ) = temp ; } }