Algorithm to Reverse a Singly Linked List
Algorithm fnSLL_Reverse(ptrStart)
{
SLLNode *ptrTemp1, ptrTemp2, ptrTemp3;
ptrTemp3=ptrStart;
ptrTemp2=NULL;
while(ptrTemp3!=NULL)
{
ptrTemp1=ptrTemp2;
ptrTemp2=ptrTemp3;
ptrTemp3=ptrTemp3->ptrNext;
ptrTemp2->ptrNext=ptrTemp1;
}
ptrStart=ptrTemp2;
return ptrStart;
} //End of Algorithm