-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.cpp
More file actions
39 lines (30 loc) · 673 Bytes
/
test.cpp
File metadata and controls
39 lines (30 loc) · 673 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
#include "AVLIndex.h"
#include <string>
#include <algorithm>
#include <iostream>
class RevStr{
string str;
public:
RevStr(){
}
RevStr(string s){
str = s;
reverse(str.begin(), str.end());
}
const char* getCStr(){
return str.c_str();
}
};
int main(){
AVLIndex<int, RevStr> index;
for(int i=1; i<=100; i++){
string str = "item_";
index.add(i, RevStr(str + to_string(i)));
}
RevStr value;
if(index.get(27, &value) == true)
printf("value is %s\n", value.getCStr());
index.remove(27);
if(index.get(27, &value) == false)
printf("Item Removed.\n");
}