10. Linked List/delete middle of linked list.cpp
Node* deleteMid(Node* head)
{
    Node * fast=head,*slow=head,*pr=NULL;
    while(fast!=NULL && fast->next!=NULL)
    {
        fast=fast->next->next;
        pr=slow;
        slow=slow->next;
    }
    pr->next=slow->next;
    delete(slow);
    return head;
}
// Deletes middle of linked list and returns head of the modified list
Deletes middle of linked list and returns head of the modified list
Deletes middle of linked list and returns head of the modified list
Node* deleteMid(Node* head)
{
    Node * fast=head,*slow=head,*pr=NULL;
    while(fast!=NULL && fast->next!=NULL)
    {
        fast=fast->next->next;
        pr=slow;
        slow=slow->next;
    }
    pr->next=slow->next;
    delete(slow);
    return head;
}
Node * deleteMid ( Node * head ) { Node * fast = head , * slow = head , * pr = NULL ; while ( fast != NULL && fast -> next != NULL ) { fast = fast -> next -> next ; pr = slow ; slow = slow -> next ; } pr -> next = slow -> next ; delete ( slow ) ; return head ; }
Deletes middle of linked list and returns head of the modified list
Deletes middle of linked list and returns head of the modified list