Advertisement
naorzr

Untitled

Feb 2nd, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.42 KB | None | 0 0
  1.  public String toString () // Time complexity: O(n), Space complexity: O(1)
  2.     {
  3.        
  4.         String str = "{";
  5.         IntNode current = _head;
  6.         while (current != null) // Goes through the set and print each element.
  7.         {
  8.             str += current.getValue() + ",";
  9.             current = current.getNext();
  10.         }
  11.         str += + "}"; // Closes the set with closing bracket.
  12.         return str;
  13.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement