Tutorials, Free Online Tutorials,It Challengers provides tutorials and interview questions of all technology like java tutorial, android, java frameworks, javascript, core java, sql, php, c language etc. for beginners and professionals.

Breaking

Data Structure - Reversing a Singly Linked List Question of Pune University (MCA)

---------------------------------- " Data Structure "---------------------------------------------   
 Reversing a Singly Linked List

struct node 
 { 
   int data; 
   struct node *next; 
 }*head=NULL,*temp,*ptr; 

void reversell() 
{       ptr=temp=head;
         temp=head->next;
         ptr=temp->next; 
         head->next=NULL; 

        while(temp) 
         { 
              temp->next=head;
           head=temp;
           temp=ptr; 
              ptr=ptr->next; 
         } 


No comments:

Post a Comment