-
Notifications
You must be signed in to change notification settings - Fork 21
/
interface.h
70 lines (42 loc) · 1.07 KB
/
interface.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//
// Created by light on 19-10-29.
//
#ifndef ALG_INTERFACE_H
#define ALG_INTERFACE_H
template<typename T>
class CommonStack {
public:
virtual int getSize() = 0;
virtual bool isEmpty() = 0;
virtual void push(T e) = 0;
virtual void pop() = 0;
virtual T peek() = 0;
};
template<typename T>
class BaseQueue {
public:
virtual bool isEmpty() = 0;
virtual int getSize() = 0;
virtual void enqueue(T e) = 0;
virtual T dequeue() = 0;
virtual T getFront() = 0;
};
template<typename Key, typename Value>
class Map {
virtual void insert(Key key, Value value) = 0;
virtual Value *remove(Key key) = 0;
virtual bool contain(Key key) = 0;
virtual Value *search(Key key) = 0;
virtual void set(Key key, Value value) = 0;
virtual int size() = 0;
virtual bool isEmpty() = 0;
};
template<typename Key>
class Set {
virtual void insert(Key key) = 0;
virtual void remove(Key key) = 0;
virtual bool contain(Key key) = 0;
virtual int size() = 0;
virtual bool isEmpty() = 0;
};
#endif //ALG_INTERFACE_H