Created
March 28, 2015 02:30
-
-
Save LucioFranco/df15de6b3f4b6d42dfe6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public LinkedList iCopy() { | |
LinkedList temp = new LinkedList(); | |
Node currentNode = this.startNode; | |
while(currentNode != null) { | |
temp.add(currentNode.getValue()); | |
currentNode = currentNode.getNextNode(); | |
} | |
return temp; | |
} | |
public LinkedList rCopy(LinkedList list, Node node) { | |
if(list == null) { | |
list = new LinkedList(); | |
node = this.startNode; | |
} | |
if(node == null) { | |
return list; | |
}else { | |
list.add(node.getValue()); | |
rCopy(list, node.getNextNode()); | |
} | |
return list; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment