title: find duplicates in a sorted linkedlist in O(n) time
body: <p>What is the most efficient way do this? Is using iterator ok?</p>
  <pre><code>public class FindDuplicates {
      public static void main(String arg[]){
          int[] str={1 , 2 , 3 ,4  ,5 ,3 ,5 , 4,3,43,1,33,4,5};
          List&lt;Integer&gt; list = new LinkedList&lt;Integer&gt;();
  
          for(int x : str) {   
              list.add(x);    
          }
  
          Collections.sort(list);
          System.out.println(list);
  
          Iterator&lt;Integer&gt; it = list.listIterator();  
          while(it.hasNext() &amp;&amp; it.next() != null) { 
              /*   Pseudocode =&gt;   if(it.next().equals(it.next.next)); */
              /* OR Pseudocode =&gt;  if(it.next() == it.next().next) */ 
              System.out.println(it) ;
          }
      }
  }
  </code></pre>