SHARE
TWEET

Untitled

a guest Nov 12th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class DNode:
  2.     Item item
  3.     Node next
  4.     Node prev
  5.  
  6.     //Funktion hat Laufzeit von O(n) n steht für die Anzahl an Listenelementen
  7.     boolean deleteLast()
  8.         if(this.next == null) //wenn die liste nur ein element hat
  9.             free(this.item)
  10.             this = null
  11.             return true
  12.  
  13.         Node iter = this
  14.         //finde vorletztes element
  15.         while(iter.next.next != null)
  16.             iter = iter.next
  17.  
  18.         //iter zeigt jetzt auf das vorletzte element
  19.         free(iter.next.item)
  20.         iter.next = null //iter ist jetzt das letzte element
  21.         return true;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top