Skip to content

Instantly share code, notes, and snippets.

@SeanPONeil
Created June 26, 2014 15:36
Show Gist options
  • Save SeanPONeil/fc56ae2e77491c32ebfa to your computer and use it in GitHub Desktop.
Save SeanPONeil/fc56ae2e77491c32ebfa to your computer and use it in GitHub Desktop.
class Node {
char data;
Node next;
}
static Node reverse(Node root){
Node reverseRoot = null;
while(root != null) {
Node next = root.next;
root.next = reverseRoot;
reverseRoot = root;
root = next;
}
return reverseRoot;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment