Advertisement
Kame3

REMOVE_DUPLICATES_SORTED

Jun 10th, 2021
870
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.38 KB | None | 0 0
  1. public static void removeDuplicate(SLL<Integer> lista) {
  2.         SLLNode<Integer> d1 = lista.getFirst();
  3.         SLLNode<Integer> tmp = null;
  4.  
  5.         while (d1 != null) {
  6.             tmp = d1;
  7.             while (tmp != null && tmp.element.equals(d1.element)) {
  8.                 tmp = tmp.succ;
  9.             }
  10.             d1.succ = tmp;
  11.             d1 = d1.succ;
  12.         }
  13.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement