Advertisement
FrancescoCipolla

Eliminazione

May 29th, 2015
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.49 KB | None | 0 0
  1.     // Eliminazione
  2.  
  3.     public void Elimina(Foglia f, Foglia f1) {
  4.         if (f1 == null) {
  5.             System.out.println("Elemento non presente");
  6.             return;
  7.         } else {
  8.             if (f.info.equals(f1.info) == true) {
  9.                 f.Fired = true;
  10.                 return;
  11.             }
  12.  
  13.             else if (f.info.compareTo(f1.info) > 0) {
  14.                 f1 = f1.getDx();
  15.                 Elimina(f, f1);
  16.             }
  17.  
  18.             else if (f.info.compareTo(f1.info) < 0) {
  19.                 f1 = f1.getSx();
  20.                 Elimina(f, f1);
  21.             }
  22.         }
  23.     }
  24.  
  25.     public void Delete(Foglia f) {
  26.         Elimina(f, Root);
  27.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement