From 0e27743f7877f0192a844aeb703194fc7e3dd39d Mon Sep 17 00:00:00 2001 From: L <@> Date: Wed, 26 Mar 2025 11:03:10 +0100 Subject: [PATCH] Mac hat alles gemacht --- Node.java | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 Node.java diff --git a/Node.java b/Node.java new file mode 100644 index 0000000..68929c5 --- /dev/null +++ b/Node.java @@ -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 häufigkeiten) + { + ArrayList nodes = new ArrayList(); + + for (Map.Entry 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; + } +}