linked_list/linked_list1.cpp
// reverse linked list by reversing the links between nodes using three pointers
reverse linked list by reversing the links between nodes using three pointers
reverse linked list by reversing the links between nodes using three pointers
void reverse_lisnked_list_b(){
    struct Node *p, *q, *r;
    p=first;
    q=NULL;
    r=NULL;
    while(p){
        r=q;
        q=p;
        p=p->next;
        q->next=r;
    }
    first=q;
}
void reverse_lisnked_list_b ( ) { struct Node * p , * q , * r ; p = first ; q = NULL ; r = NULL ; while ( p ) { r = q ; q = p ; p = p -> next ; q -> next = r ; } first = q ; }
reverse linked list by reversing the links between nodes using three pointers
reverse linked list by reversing the links between nodes using three pointers
// we will use the concept of sliding pointers using three different // pointers tail to each other // initialize three pointers // points to first // null pointer before p // null but following q (assumption) // while p is not null // r follows q // q foloows p // and p moves forward by one step each // and q points to r in reverse direction // q becomes first node of the linked list