See you are actually passing the address of 'rest' each time, so the changes made to *head_ref are actually reflected in the value at the address of 'rest' each time the recursive call returns, so the value of 'rest' is carried backwards to the front once we start popping from the tail of the list. Hence you have 5th node at the head towards the end. Hope this helps. :)
Dipit Grover B.tech 3rd year IIT Roorkee -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
