Skip to content

Instantly share code, notes, and snippets.

@Gofilord
Created November 4, 2014 15:18
Show Gist options
  • Save Gofilord/f9625f7aeb0ed01dfc24 to your computer and use it in GitHub Desktop.
Save Gofilord/f9625f7aeb0ed01dfc24 to your computer and use it in GitHub Desktop.
Create node chain without array
Node<Integer> lastNode = new Node<Integer>(rndVal, null);
Node<Integer> nextNode = new Node<Integer>(rndVal - 1, lastNode);
for (int i = rndVal - 2; i >= 0; i--)
nextNode = new Node<Integer>(i, nextNode);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment