-
Notifications
You must be signed in to change notification settings - Fork 21
/
BSTMap.h
48 lines (36 loc) · 789 Bytes
/
BSTMap.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//
// Created by light on 19-11-8.
//
#ifndef ALG_BSTMAP_H
#define ALG_BSTMAP_H
// 有序集合
template<typename Key, typename Value>
class BSTMap : public Map<Key, Value> {
private:
BST<Key, Value> bst;
public:
BSTMap() {
}
virtual int size() {
return bst.size();
}
virtual bool isEmpty() {
return bst.isEmpty();
}
virtual bool contain(Key key) {
return bst.contain(key);
}
virtual Value *search(Key key) {
return bst.search(key);
}
virtual void set(Key key, Value value) {
bst.set(key, value);
}
virtual void insert(Key key, Value value) {
bst.insert(key, value);
}
virtual Value *remove(Key key) {
return bst.remove(key);
}
};
#endif //ALG_BSTMAP_H