Update 9.3.22

master
Mischa 2022-03-09 16:03:32 +01:00
parent 1db7d7316d
commit 818be00c30
3 changed files with 37 additions and 4 deletions

View File

@ -114,7 +114,7 @@ public class LinkedList<A> {
return I;
}
public int grˆe() { // Methode um grˆe auszugeben
public int groeße() { // Methode um grˆï¬e auszugeben
System.out.print("Die Grˆfle der Liste ist: "); //ausgabe
System.out.println(size + "\n"); //ausgabe
return size; // gibt grˆfle zur¸ck

View File

@ -38,13 +38,13 @@ private int size;
while (current != null) { // solange current ungleich null ist wird das in der Schleife ausgefÔøΩhrt
if (current.wert == wert) { // wenn der der Knoten current = der wert ist
System.out.println(wert + " " + "ist nicht der Liste");
return true; // dann gibt es den eintrag also muss er true zurÔøΩckgeben
}
current = current.next; // n‰chster wert wird zum aktuellen
}
System.out.println(wert + " " + "ist in der Liste");
return false; // sonst ist er nicht drin
}
public void remove(P wert) {
@ -60,6 +60,39 @@ private int size;
current = current.next;
}
}
public void Ausgabe() {
Node<P> current = this.start;
while(current != null) {
System.out.print(current.wert + " ");
current = current.next;
} System.out.print("\n");
}
public int size() { // getter Mehode f¸r grˆfle
return this.size;
}
public Node<P> getStart() { // getter Mehode f¸r Start
return this.start;
}
public Set<P> intersection(Set<P> s) {
Set<P> result = new Set<P>();
Node<P> current = this.start;
while(current != null) {
if(s.contains(current.wert)) result.add(current.wert);
current = current.next;
}
return result;
}
public Set<P> union(Set<P> s) {
Set<P> result = new Set<P>();
Node<P> current = this.start;
while(current != null) {
current = current.next;
}
return result;
}
}

View File

@ -14,7 +14,7 @@ public class SetTest {
set.isEmpty();
Set<Integer> I = set.intersection(set2);
System.out.println("Größe " + set.size());
System.out.println("Groeße " + set.size());
set.Ausgabe();
}