Created
January 17, 2017 17:08
-
-
Save martinschaef/0e8244f91670244e4569b366474bbf30 to your computer and use it in GitHub Desktop.
Example from Sec 2
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 class Maun { | |
public static class Node { | |
final Node next; | |
final int data; | |
public Node(Node next, int data) { | |
this.next = next; | |
this.data = data; | |
} | |
} | |
public static void main(String[] args) { | |
final int size = 10; | |
final int[] table = new int[size]; | |
Node l1 = null; | |
Node l2 = null; | |
for (int i = 0; i < args.length; i++) { | |
int d = Integer.parseInt(args[i]); | |
if (d >= 0 && d < size) { | |
l1 = new Node(l1, d); | |
} else { | |
l2 = new Node(l2, d); | |
} | |
} | |
while (l1 != null) { | |
table[l1.data]++; | |
l1 = l1.next; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment