Compare commits
5 Commits
ff28fcb099
...
main
Author | SHA1 | Date | |
---|---|---|---|
c2347281fc | |||
3d7526fd3c | |||
|
7d1af4bd85 | ||
|
ac503234b2 | ||
|
be8b24140e |
BIN
Folien/Alle Folien AuD.pdf
Normal file
BIN
Folien/Alle Folien AuD.pdf
Normal file
Binary file not shown.
BIN
Folien/AuD_01_ElementareDatentypen.pdf
Normal file
BIN
Folien/AuD_01_ElementareDatentypen.pdf
Normal file
Binary file not shown.
BIN
Folien/AuD_02_AlgoBewertung.pdf
Normal file
BIN
Folien/AuD_02_AlgoBewertung.pdf
Normal file
Binary file not shown.
BIN
Folien/AuD_03_Graphen.pdf
Normal file
BIN
Folien/AuD_03_Graphen.pdf
Normal file
Binary file not shown.
BIN
Folien/AuD_04_Baeume.pdf
Normal file
BIN
Folien/AuD_04_Baeume.pdf
Normal file
Binary file not shown.
BIN
Folien/AuD_04_Baeume_Lsg_Stift.pdf
Normal file
BIN
Folien/AuD_04_Baeume_Lsg_Stift.pdf
Normal file
Binary file not shown.
BIN
Folien/AuD_05_GraphAlgo_1.pdf
Normal file
BIN
Folien/AuD_05_GraphAlgo_1.pdf
Normal file
Binary file not shown.
BIN
Folien/AuD_06_GraphAlgo_2.pdf
Normal file
BIN
Folien/AuD_06_GraphAlgo_2.pdf
Normal file
Binary file not shown.
BIN
Folien/AuD_07_Sortieren_1.pdf
Normal file
BIN
Folien/AuD_07_Sortieren_1.pdf
Normal file
Binary file not shown.
BIN
Folien/AuD_08_Sortieren_2.pdf
Normal file
BIN
Folien/AuD_08_Sortieren_2.pdf
Normal file
Binary file not shown.
BIN
Folien/AuD_09_Sortieren_3.pdf
Normal file
BIN
Folien/AuD_09_Sortieren_3.pdf
Normal file
Binary file not shown.
BIN
Folien/AuD_10_Suchen_1.pdf
Normal file
BIN
Folien/AuD_10_Suchen_1.pdf
Normal file
Binary file not shown.
BIN
Folien/AuD_11_Suchen_2.pdf
Normal file
BIN
Folien/AuD_11_Suchen_2.pdf
Normal file
Binary file not shown.
BIN
Folien/AuD_12_Suchen_3.pdf
Normal file
BIN
Folien/AuD_12_Suchen_3.pdf
Normal file
Binary file not shown.
BIN
Folien/AuD_13_Suchen_4.pdf
Normal file
BIN
Folien/AuD_13_Suchen_4.pdf
Normal file
Binary file not shown.
BIN
Folien/AuD_14_Codierung.pdf
Normal file
BIN
Folien/AuD_14_Codierung.pdf
Normal file
Binary file not shown.
BIN
Folien/AuD_15_Kompression.pdf
Normal file
BIN
Folien/AuD_15_Kompression.pdf
Normal file
Binary file not shown.
@@ -8,6 +8,19 @@ package part1.aufg6;
|
|||||||
*/
|
*/
|
||||||
public class Anwendung {
|
public class Anwendung {
|
||||||
public static void main(String[] args){
|
public static void main(String[] args){
|
||||||
System.out.println("Moin");
|
LinkedList myList = new LinkedList();
|
||||||
|
|
||||||
|
myList.add("a");
|
||||||
|
myList.add("b");
|
||||||
|
myList.add("c");
|
||||||
|
myList.add("d");
|
||||||
|
// myList.add("e");
|
||||||
|
// myList.add("f");
|
||||||
|
|
||||||
|
myList.delete("a"); // Wird der Speicher der abgekoppelten Zelle freigegeben? Automatisch von JVM?
|
||||||
|
myList.delete("b");
|
||||||
|
myList.delete("c");
|
||||||
|
myList.delete("d");
|
||||||
|
myList.printALL();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -33,6 +33,9 @@ public class LinkedList<T>{
|
|||||||
|
|
||||||
}
|
}
|
||||||
public void printALL(){ // correct???
|
public void printALL(){ // correct???
|
||||||
|
if (anchor==null){
|
||||||
|
return;
|
||||||
|
}
|
||||||
Cell<T> next = anchor.next;
|
Cell<T> next = anchor.next;
|
||||||
|
|
||||||
System.out.println(anchor.data);
|
System.out.println(anchor.data);
|
||||||
@@ -62,4 +65,34 @@ public class LinkedList<T>{
|
|||||||
next = next.next; // must happen at end of loop
|
next = next.next; // must happen at end of loop
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void delete(T value){
|
||||||
|
System.out.println("Removing " + '"' + value + '"');
|
||||||
|
if (anchor == null)return;
|
||||||
|
if (anchor.data == value){
|
||||||
|
anchor = anchor.next;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((anchor.next != null) && (anchor.next.data == value)){
|
||||||
|
anchor.next = anchor.next.next;
|
||||||
|
}
|
||||||
|
|
||||||
|
var cell = anchor.next;
|
||||||
|
|
||||||
|
while (cell != null && cell.next != null){
|
||||||
|
if (cell.next.data == value) {
|
||||||
|
if (cell.next.next != null) {
|
||||||
|
cell.next = cell.next.next;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((cell.next.next == null) && (cell.next.data == value)){
|
||||||
|
cell.next = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
cell = cell.next;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user