Ubgrade 1.3.
parent
442f28e8d7
commit
6352d27cf1
|
@ -92,6 +92,39 @@ return Suche(ü, u.rechts);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
public void zurückcodieren(String b){
|
||||||
|
String Suche = "";
|
||||||
|
for(int i = 0; i<b.length(); i++){
|
||||||
|
//sucht Binärcode
|
||||||
|
Suche += b.charAt(i);
|
||||||
|
Node n = SucheBinärcode(Suche, Final);
|
||||||
|
if(n != null){
|
||||||
|
System.out.print(n.wert);
|
||||||
|
Suche = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public Node SucheBinärcode(String ü, Node u){
|
||||||
|
//sucht Node mit gesuchtem Binärcode im Binärbaum
|
||||||
|
if(ü.equals(u.Binärcode)){
|
||||||
|
return u;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
//sucht im linken Teil des Baums
|
||||||
|
if(u.links != null ){
|
||||||
|
if(SucheBinärcode(ü, u.links)!= null){
|
||||||
|
return SucheBinärcode(ü, u.links);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//sucht im rechten Teil des Baumes
|
||||||
|
if(u.rechts != null){
|
||||||
|
if(SucheBinärcode(ü, u.rechts) != null){
|
||||||
|
return SucheBinärcode(ü, u.rechts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
public int Minimum(ArrayList<Node> l){
|
public int Minimum(ArrayList<Node> l){
|
||||||
//setzt temporäres Minimum auf der ersten Stelle der ArrayList
|
//setzt temporäres Minimum auf der ersten Stelle der ArrayList
|
||||||
int minindex = 0;
|
int minindex = 0;
|
||||||
|
|
Loading…
Reference in New Issue