Advertisement
Kame3

REMOVE_DUPLICATES_UNSORTED

Jun 10th, 2021
581
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.57 KB | None | 0 0
  1. public static void brisiDuplikati(SLL<Integer> lista) {
  2.         SLLNode<Integer> d1 = lista.getFirst();
  3.         SLLNode<Integer> pom = null;
  4.         SLLNode<Integer> temp = null;
  5.        
  6.         while (d1 != null) {
  7.             temp = d1;
  8.             pom = d1.succ;
  9.            
  10.             while (pom != null) {
  11.                 if (d1.element == pom.element) {
  12.                     temp.succ = pom.succ;
  13.                 } else {
  14.                     temp = pom;
  15.                 }
  16.                 pom = pom.succ;
  17.             }
  18.             d1 = d1.succ;
  19.         }
  20.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement