-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathvector.cpp
More file actions
53 lines (44 loc) · 856 Bytes
/
vector.cpp
File metadata and controls
53 lines (44 loc) · 856 Bytes
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
#include <iostream>
#include "Vector.h"
using namespace std;
template <typename T>
class MyPrint
{
public:
void operator()(T e)
{
cout << e << " ";
}
};
int main()
{
Vector<int> a(5);
a.insert(0, 2);
a.insert(0, 6);
a.insert(0, 7);
// cout << a.capacity() << endl;
a.insert(0, 4);
a.insert(0, 4);
a.insert(0, 5);
a.insert(0, 9);
a.insert(0, 9);
a.insert(0, 5);
a.insert(0, 5);
a.insert(0, 9);
a.insert(0, 9);
a.insert(0, 5);
// cout << a.capacity() << endl;
MyPrint<int> visit;
// a.travser(visit);
a.sort();
a.travser(visit);
cout << endl;
cout << a.search(1) << endl;
cout << a.search(2) << endl;
cout << a.search(3) << endl;
//cout << "uniquify " << a.uniquify() << endl;
//cout << "deduplicate " << a.deduplicate() << endl;
//cout << a.search(7, 0, a.size());
//cout << a.search(8, 0, a.size());
return 0;
}