package edu.ics211.h11; import java.io.File; /** * @author Benjamin Strauss, Edo Biagioni, * */ public class BinaryStringTree { //TODO add the private BinaryNode class here //TODO add all class variables here public BinaryStringTree() { } /** * Construct a new BinaryStringTree using the words in the given file * @param fileName */ public BinaryStringTree(String fileName) { /* TODO * hint: to read a file word-by-word, use Scanner.next() */ } /** * * @param key * @return the number of occurrences of the given String, * that is, the value for the given key, or * 0 if the String is not found */ public long occurrences(String key) { //TODO: call a private recursive helper method that you design return 0; } public java.util.Set keys() { java.util.Set result = new java.util.HashSet<>(); // TODO: call a private recursive helper method to fill the // set with all the keys in the tree return result; } public void add(String key) { // TODO: if the key is not in the tree, add it with a value 1 // if it is in the tree, just increment the value } /** * Removes one occurrence of the given key from the tree, usually * by decrementing the value associated with the key. * However, if the key has a value of 1, deletes the node * If the key is not in the tree, does nothing. * @param key */ public void removeOne(String key) { //TODO } /** * Removes the given String from the tree by deleting the node * @param key */ public void remove(String key) { //TODO } /** * * @return number of nodes in the tree == the number of unique Strings */ public int size() { //TODO return 0; } /** * * @return the height of the tree. An empty tree has height 0, * a tree with one node has height 1 */ public int height() { //TODO return 0; } }