struct node *search(struct node *ptr,int key) {// A pointer which will follow ptrstruct node *prev =NULL;while (ptr !=NULL) {if (p -> data == key) {// Move the found node to the start prev -> next =ptr -> next;ptr -> next = head; head = ptr;return ptr; } prev = ptr; ptr =ptr -> next; }returnNULL;}