7 Star 34 Fork 23

空無一悟/algorithms

Create your Gitee Account
Explore and code with more than 13.5 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
BSTSet.java 972 Bytes
Copy Edit Raw Blame History
空無一悟 authored 2021-09-22 23:47 +08:00 . init
/***********************************************************
* @Description : 基于第六章的BST实现的集合(BSTSet)
* @author : 梁山广(Laing Shan Guang)
* @date : 2018/5/16 23:19
* @email : liangshanguang2@gmail.com
***********************************************************/
package Chapter07SetAndMap.Section1SetBasicAndBSTSet;
import Chapter06BST.BST;
public class BSTSet<E extends Comparable<E>> implements Set<E> {
private BST<E> bst;
public BSTSet() {
bst = new BST<>();
}
@Override
public void add(E e) {
bst.add(e);
}
@Override
public void delete(E e) {
bst.remove(e);
}
@Override
public boolean contain(E e) {
// 这里的e实际指地是key哈
return bst.contains(e);
}
@Override
public int getSize() {
return bst.getSize();
}
@Override
public boolean isEmpty() {
return bst.isEmpty();
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/lsgwr/algorithms.git
git@gitee.com:lsgwr/algorithms.git
lsgwr
algorithms
algorithms
master

Search