How to reverse a linked list
Anonymous
reverse list(){ node prev=null; node current=head; node next; while(current){ next=current.next; current.next=prev; prev=current; current=next; } head=prev; }
Check out your Company Bowl for anonymous work chats.