如果我创建了bst
类,如何使用二叉搜索树实现字典?
public class BinarySearchTree<E> extends Comparable<E>> implements Iterable<E>{
//bst methods(add, remove, find), node class, inOrderIterator,
}
public class BSTDic<K extends Comparable<K>, V> {
//how would i start it off or would i need to instantiate a bst data?
//additionally i need methods such as add(K key, V value), how would i approach those
}
我们非常感谢任何建议,我只需要一个起点帮助。