update 9.3.22 Zuhause
							parent
							
								
									c79bd06ca4
								
							
						
					
					
						commit
						7e76521592
					
				|  | @ -1,5 +1,5 @@ | ||||||
| 
 | 
 | ||||||
| public class Ausführer { | public class Ausführer { | ||||||
| 
 | 
 | ||||||
| 	public static void main(String[] args) { | 	public static void main(String[] args) { | ||||||
| 		 | 		 | ||||||
|  |  | ||||||
|  | @ -1,5 +1,5 @@ | ||||||
| 
 | 
 | ||||||
| public class AusführerQueue { | public class AusführerQueue { | ||||||
| 	 | 	 | ||||||
| 	public static void main(String[] args) { | 	public static void main(String[] args) { | ||||||
| 		 | 		 | ||||||
|  |  | ||||||
|  | @ -1,37 +1,40 @@ | ||||||
| 
 | 
 | ||||||
| public class AusführerSet { | public class AusführerSet { | ||||||
| 	 | 	 | ||||||
| 	public static void main(String[] args) { | 	public static void main(String[] args) { | ||||||
| 		 | 		 | ||||||
| 		Set<Integer> Set = new Set<Integer>(); | 		Set<Integer> Set = new Set<Integer>(); | ||||||
| 		Set<Integer> Set2 = new Set<Integer>(); | 		Set<Integer> Set2 = new Set<Integer>(); | ||||||
| 		 | 		 | ||||||
| 		Set.add(1); | 		Set.add(1);//fügt neue variable der Liste an
 | ||||||
| 		Set.add(3); | 		Set.add(3);//fügt neue variable der Liste an
 | ||||||
| 		Set.add(5); | 		Set.add(5);//fügt neue variable der Liste an
 | ||||||
| 		Set.add(5); | 		Set.add(5);//fügt neue variable der Liste an
 | ||||||
| 		Set.add(7); | 		Set.add(7);//fügt neue variable der Liste an
 | ||||||
| 		Set.add(9); | 		Set.add(9);//fügt neue variable der Liste an
 | ||||||
| 		 | 		 | ||||||
| 		Set2.add(2); | 		Set2.add(2);//fügt neue variable der Liste zweiten Liste an
 | ||||||
| 		Set2.add(3); | 		Set2.add(3);//fügt neue variable der Liste zweiten Liste an
 | ||||||
| 		Set2.add(4); | 		Set2.add(4);//fügt neue variable der Liste zweiten Liste an
 | ||||||
| 		Set2.add(6); | 		Set2.add(6);//fügt neue variable der Liste zweiten Liste an
 | ||||||
| 		Set2.add(9); | 		Set2.add(9);//fügt neue variable der Liste zweiten Liste an
 | ||||||
| 		 | 		 | ||||||
| 		 | 		 | ||||||
| 		System.out.println(Set.contains(4)); | 		System.out.println(Set.contains(4)); //kontrolliert ob eine bestimme variable in der liste vorhanden ist und gibt das ergebnis aus
 | ||||||
| 		 | 		 | ||||||
| 		System.out.println(Set.isEmpty()); | 		System.out.println(Set.isEmpty());	//kontrolliert ob die liste leer ist und gibt das ergebnis aus
 | ||||||
| 		 | 		 | ||||||
| 		Set.remove(7); | 		Set.remove(7); //entfernt eine bstimme variable 
 | ||||||
| 		 | 		 | ||||||
| 		Set<Integer> I = Set.intersection (Set2); | 		Set<Integer> I = Set.intersection(Set2);//fügt variablen die in beiden listen vorhanden sind in einer zusammen
 | ||||||
| 		I.Ausgabe(); | 		I.Ausgabe();//gibt diese liste aus
 | ||||||
| 		 | 		 | ||||||
| 		System.out.println(Set.size()); | 		//Set<Integer> U = Set.union(Set2);
 | ||||||
|  | 		//U.Ausgabe();
 | ||||||
| 		 | 		 | ||||||
| 		Set.Ausgabe(); | 		System.out.println(Set.size()); //gibt die größe der liste aus
 | ||||||
|  | 		 | ||||||
|  | 		Set.Ausgabe();	//gibt die einzelnen variablen in der liste aus
 | ||||||
| 		 | 		 | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,5 +1,5 @@ | ||||||
| 
 | 
 | ||||||
| public class AusführerStack { | public class AusführerStack { | ||||||
| 
 | 
 | ||||||
| 	public static void main(String[] args) { | 	public static void main(String[] args) { | ||||||
| 		 | 		 | ||||||
|  |  | ||||||
|  | @ -1,36 +1,34 @@ | ||||||
| 
 | 
 | ||||||
| public class Set<X> { | public class Set<X> { | ||||||
| 
 | 
 | ||||||
| 	private Node<X> start; | 	private Node<X> start;	 | ||||||
| 	 | 	 | ||||||
| 	private int size; | 	private int size; //variable für die größe
 | ||||||
| 	 | 	 | ||||||
| 	public Set() { | 	public Set() {			//Konstrukter der die Startwertde der liste angibt
 | ||||||
| 		this.start = null; | 		this.start = null;		//Startwert für "start" ist "null"
 | ||||||
| 		this.size = 0; | 		this.size = 0;			//Startwert für die größe alos "size" ist 0
 | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| 	public boolean isEmpty() {	 | 	public boolean isEmpty() {	//Methode für den test ob die liste leer ist
 | ||||||
| 		if(size == 0) {	 | 		if(size == 0) {	//solange die größe noch 0 ist
 | ||||||
| 			return true;		 | 			return true;		//positiver ergebnis, dass die Liste leer ist
 | ||||||
| 		} else {		 | 		} else {		//ansonsten
 | ||||||
| 			return false; | 			return false;	 //negative ergebnis, ass die liste Werte enthält
 | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| 	public boolean contains(X wert) { | 	public boolean contains(X wert) {									//Methode um herauszufinden ob ein bestimmter wert in der Liste vorhanden ist
 | ||||||
|  | 		Node<X> current = this.start;									//initialisiert den knoten current
 | ||||||
|  | 		while(current != null) {										//wärend der wert von current ungleicht "null" ist
 | ||||||
| 		 | 		 | ||||||
| 		Node<X> current = this.start;									 | 			if(current.wert == wert) {									//wenn der Wert von current gleich dem eingegebenen "wert" ist
 | ||||||
| 		while(current != null) {										 | 				return true;											//positives ergebnis für den durchgeführten test
 | ||||||
| 			 |  | ||||||
| 			if(current.wert == wert) {									 |  | ||||||
| 				return true;											 |  | ||||||
| 			} | 			} | ||||||
| 			current = current.next; 									 | 			current = current.next; 									//nächste wert von current wird zum aktuellen
 | ||||||
| 			 | 		 | ||||||
| 		} | 		} | ||||||
| 		return false; | 		return false;	//negatives ergebnis für den durchgeführten test
 | ||||||
| 			 |  | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| 	public void add(X wert) { | 	public void add(X wert) { | ||||||
|  | @ -54,18 +52,18 @@ public class Set<X> { | ||||||
| 		 | 		 | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| 	public void remove(X wert) { | 	public void remove(X wert) {//methode um dne wert an einer bestimmten stelle zu entfernen
 | ||||||
| 		Node<X> current = this.start; | 		Node<X> current = this.start;//initialisiert den Knoten current
 | ||||||
| 		if(current.wert == wert) { | 		if(current.wert == wert) {	//wenn der aktuelle wert dem eingegebenen entspricht
 | ||||||
| 			this.start = current.next; | 			this.start = current.next;	//wird der start zur nächsten variable
 | ||||||
| 			size--; | 			size--;	//1 wind von der größe subtrahiert
 | ||||||
| 		} | 		} | ||||||
| 			while(current.next != null) { | 			while(current.next != null) {	//wärend die nächste variable ungleich null ist
 | ||||||
| 				if(current.next.wert == wert) { | 				if(current.next.wert == wert) {	//wenn der nächste wert gleich dem eingegebenen wert ist
 | ||||||
| 					current.next = current.next.next; | 					current.next = current.next.next;	//wird die nächste variable zur übernächsten
 | ||||||
| 					size--; | 					size--;	//1 wird von der größe abgezogen
 | ||||||
| 				} else { | 				} else {	//ansonsten
 | ||||||
| 					current = current.next; | 					current = current.next;	//wird der aktuelle wert zum nächsten
 | ||||||
| 				} | 				} | ||||||
| 			 | 			 | ||||||
| 			} | 			} | ||||||
|  | @ -83,6 +81,7 @@ public class Set<X> { | ||||||
| 	 | 	 | ||||||
| 	//public Set<X> union(Set<X> s) {
 | 	//public Set<X> union(Set<X> s) {
 | ||||||
| 		 | 		 | ||||||
|  | 
 | ||||||
| 	//}
 | 	//}
 | ||||||
| 	 | 	 | ||||||
| 	/*public Set<X> difference(Set<X> s) { | 	/*public Set<X> difference(Set<X> s) { | ||||||
|  | @ -93,21 +92,21 @@ public class Set<X> { | ||||||
| 		 | 		 | ||||||
| 	} */ | 	} */ | ||||||
| 	 | 	 | ||||||
| 	public Node<X> getStart() {  | 	public Node<X> getStart() { //erstellt start zum getten
 | ||||||
| 		return this.start;		 | 		return this.start;		//gibt start zurück
 | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| 	public int size() {	 | 	public int size() {	//erstellt size zum getten
 | ||||||
| 		return this.size;	 | 		return this.size;	//gibt size zurück
 | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| 	public void Ausgabe() { | 	public void Ausgabe() { | ||||||
| 		Node<X> current = this.start;	 | 		Node<X> current = this.start;	//initialisiert die liste
 | ||||||
| 				 | 		 | ||||||
| 			while(current != null) {	 | 	while(current != null) {	//solange current also der aktuelle Wert ungleich "null" ist
 | ||||||
| 				System.out.print(current.wert + " ");	 | 		System.out.print(current.wert + " ");	//gibt den aktuellen Wert aus
 | ||||||
| 				current = current.next;	 | 		current = current.next;	//geht zum nächsten Wert
 | ||||||
| 			} System.out.print("\n"); | 	}System.out.print("\n"); | ||||||
| 	} | } | ||||||
| 	 | 	 | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue