I\'m having some trouble create a linkedlist in reverse order from a given linkedlist.
I come from a java background, and just started doing some C++.
Can yo
This is done using just two temporary variables.
Node* list::rev(Node *first) { Node *a = first, *b = first->next; while(a->next!=NULL) { b = a->next; a->next = a->next->next; b->next = first; first = b; } return first; }
Also, you can do this using recursion.