Iterative Method:
Code:
NODE* ReverseList(NODE *ptr){
NODE* prevPtr= NULL;
while(ptr)
{
NODE* tmp = ptr->next;
ptr->next = prevPtr;
prevPtr = ptr;
ptr = tmp;
}
return ptr;
}
Recursive Solution:
Code:
NODE* reverseList(NODE* ptr){
if(ptr == NULL) return ptr;
else
return( reverseList(ptr->next)->next=ptr);
}
_________________
Truth Can'nt be changed That is only one in the world "DEATH"

