suche implementiert

This commit is contained in:
dom
2025-02-18 22:14:32 +12:00
parent 22cbfea63c
commit 933fdd7b16
4 changed files with 23 additions and 2 deletions

View File

@@ -30,6 +30,18 @@ public class Knoten extends Baumelement
}
return this;
}
public Datenelement Suche(String suche){
if (this.daten.gibSchlüssel() == suche) {
return daten;
} else {
if (this.daten.gibSchlüssel().compareTo(suche)>0) {
return this.linkerNachfolger.Suche(suche);
} else {
return this.rechterNachfolger.Suche(suche);
}
}
}