CSC301: More Size: Using a built in iterator [2/30] |
public class IntSet { private Node root; private static class Node { public final int key; public Node left, right; public Node (int key) { this.key = key; } } public int size () { int size = 0; for (int x : this.levelOrder ()) size++; return size; } ...
This violates two conditions of the assignment.
levelOrder
,
but it creates an object nonetheless, so it violates the
condition of the assignment.