Mac hat alles gemacht
parent
20b276844d
commit
0e27743f78
|
@ -0,0 +1,83 @@
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Node
|
||||
{
|
||||
private Node left;
|
||||
private Node right;
|
||||
private int anzahl;
|
||||
private Character buchstabe;
|
||||
|
||||
public Node()
|
||||
{
|
||||
}
|
||||
|
||||
public Node(Node left, Node right)
|
||||
{
|
||||
this.left = left;
|
||||
this.right = right;
|
||||
}
|
||||
|
||||
public Node getLeft()
|
||||
{
|
||||
return left;
|
||||
}
|
||||
|
||||
public Node getRight()
|
||||
{
|
||||
return right;
|
||||
}
|
||||
|
||||
public void setLeft(Node left)
|
||||
{
|
||||
this.left = left;
|
||||
}
|
||||
|
||||
public void setRight(Node right)
|
||||
{
|
||||
this.right = right;
|
||||
}
|
||||
|
||||
public int getAnzahl()
|
||||
{
|
||||
return anzahl;
|
||||
}
|
||||
|
||||
public Character getBuchstabe()
|
||||
{
|
||||
return buchstabe;
|
||||
}
|
||||
|
||||
public void setAnzahl(int anzahl)
|
||||
{
|
||||
this.anzahl = anzahl;
|
||||
}
|
||||
|
||||
public void setBuchstabe(Character buchstabe)
|
||||
{
|
||||
this.buchstabe = buchstabe;
|
||||
}
|
||||
|
||||
public static Node erstellen(Map<Character, Integer> häufigkeiten)
|
||||
{
|
||||
ArrayList<Node> nodes = new ArrayList<Node>();
|
||||
|
||||
for (Map.Entry<Character, Integer> entry : häufigkeiten.entrySet())
|
||||
{
|
||||
Character character = entry.getKey();
|
||||
int anzahl = entry.getValue();
|
||||
}
|
||||
|
||||
while (nodes.size() > 1)
|
||||
{
|
||||
Node min1 = nodes.get(1);
|
||||
|
||||
for (Node node : nodes)
|
||||
{
|
||||
//if(node.getCount() < min1.getCount())
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue