Initial sharing of project
commit
71992422a4
|
@ -0,0 +1,28 @@
|
|||
|
||||
/**
|
||||
* Beschreiben Sie hier die Klasse binärbaum.
|
||||
*
|
||||
* @author (Ihr Name)
|
||||
* @version (eine Versionsnummer oder ein Datum)
|
||||
*/
|
||||
public class Binärbaum
|
||||
{
|
||||
//Attribute
|
||||
public Object wert;
|
||||
public Binärbaum links;
|
||||
public Binärbaum rechts;
|
||||
|
||||
//Konstruktoren
|
||||
//Konstruktoren für ein Blatt
|
||||
|
||||
//Konstruktor für inneren Knoten
|
||||
|
||||
public void einfügen(int [] Anzahl){
|
||||
for(int i =0 ; i<Anzahl.length; i++){
|
||||
if(Anzahl[i] >= 1){
|
||||
Node n = new Node((char)(i + 65), Anzahl[i]) ;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
|
||||
/**
|
||||
* Beschreiben Sie hier die Klasse List.
|
||||
*
|
||||
* @author (Ihr Name)
|
||||
* @version (eine Versionsnummer oder ein Datum)
|
||||
*/
|
||||
public class List
|
||||
{
|
||||
public static int [] zählen(String text){
|
||||
int[] Anzahl = new int[26];
|
||||
for(int i = 0; i<text.length(); i++){
|
||||
int position = text.charAt(i) -65;
|
||||
Anzahl [position] ++;
|
||||
}
|
||||
return Anzahl;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
|
||||
/**
|
||||
* Beschreiben Sie hier die Klasse Node.
|
||||
*
|
||||
* @author (Ihr Name)
|
||||
* @version (eine Versionsnummer oder ein Datum)
|
||||
*/
|
||||
public class Node
|
||||
{
|
||||
//Attribute
|
||||
public char wert;
|
||||
public Node rechts;
|
||||
public Node links;
|
||||
public int Anzahl;
|
||||
//Konstruktor
|
||||
public Node(char w, int a){
|
||||
wert = w;
|
||||
Anzahl = a;
|
||||
}
|
||||
//Konstruktor linker Knoten
|
||||
public void setLinks(Node l){
|
||||
links = l;
|
||||
|
||||
}
|
||||
public void setRechts(Node r){
|
||||
rechts = r;
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
------------------------------------------------------------------------
|
||||
Dies ist die README-Datei des Projekts. Hier sollten Sie Ihr Projekt
|
||||
beschreiben.
|
||||
Erzählen Sie dem Leser (jemand, der nichts über dieses Projekt weiss),
|
||||
alles, was er/sie wissen muss. Üblicherweise sollte der Kommentar
|
||||
zumindest die folgenden Angaben umfassen:
|
||||
------------------------------------------------------------------------
|
||||
|
||||
PROJEKTBEZEICHNUNG:
|
||||
PROJEKTZWECK:
|
||||
VERSION oder DATUM:
|
||||
WIE IST DAS PROJEKT ZU STARTEN:
|
||||
AUTOR(EN):
|
||||
BENUTZERHINWEISE:
|
|
@ -0,0 +1,23 @@
|
|||
|
||||
/**
|
||||
* Beschreiben Sie hier die Klasse Test.
|
||||
*
|
||||
* @author (Ihr Name)
|
||||
* @version (eine Versionsnummer oder ein Datum)
|
||||
*/
|
||||
public class Test
|
||||
{
|
||||
|
||||
public static void main(){
|
||||
List text = new List();
|
||||
//legt String mit Inhalt Abrakadabra an
|
||||
String Text = "ABRAKADABRA";
|
||||
//ruft tählen Methode aus List auf
|
||||
int [] Anzahl= List.zählen(Text);
|
||||
//legt Binärbaum an
|
||||
Binärbaum b = new Binärbaum();
|
||||
//fügt die vorhandenen Buchstaben in den binärbaum ein
|
||||
b.einfügen(Anzahl);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
#BlueJ package file
|
||||
dependency1.from=Test
|
||||
dependency1.to=List
|
||||
dependency1.type=UsesDependency
|
||||
dependency2.from=Test
|
||||
dependency2.to=Bin\u00E4rbaum
|
||||
dependency2.type=UsesDependency
|
||||
dependency3.from=Bin\u00E4rbaum
|
||||
dependency3.to=Node
|
||||
dependency3.type=UsesDependency
|
||||
editor.fx.0.height=728
|
||||
editor.fx.0.width=800
|
||||
editor.fx.0.x=720
|
||||
editor.fx.0.y=166
|
||||
objectbench.height=100
|
||||
objectbench.width=776
|
||||
package.divider.horizontal=0.6
|
||||
package.divider.vertical=0.8003731343283582
|
||||
package.editor.height=422
|
||||
package.editor.width=661
|
||||
package.editor.x=415
|
||||
package.editor.y=260
|
||||
package.frame.height=600
|
||||
package.frame.width=800
|
||||
package.numDependencies=3
|
||||
package.numTargets=4
|
||||
package.showExtends=true
|
||||
package.showUses=true
|
||||
project.charset=UTF-8
|
||||
readme.height=60
|
||||
readme.name=@README
|
||||
readme.width=48
|
||||
readme.x=10
|
||||
readme.y=10
|
||||
target1.height=70
|
||||
target1.name=Test
|
||||
target1.showInterface=false
|
||||
target1.type=ClassTarget
|
||||
target1.width=120
|
||||
target1.x=300
|
||||
target1.y=90
|
||||
target2.height=70
|
||||
target2.name=Node
|
||||
target2.showInterface=false
|
||||
target2.type=ClassTarget
|
||||
target2.width=120
|
||||
target2.x=10
|
||||
target2.y=170
|
||||
target3.height=70
|
||||
target3.name=List
|
||||
target3.showInterface=false
|
||||
target3.type=ClassTarget
|
||||
target3.width=120
|
||||
target3.x=10
|
||||
target3.y=90
|
||||
target4.height=70
|
||||
target4.name=Bin\u00E4rbaum
|
||||
target4.showInterface=false
|
||||
target4.type=ClassTarget
|
||||
target4.width=120
|
||||
target4.x=70
|
||||
target4.y=10
|
Loading…
Reference in New Issue