-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest1_d.cpp
More file actions
49 lines (38 loc) · 950 Bytes
/
test1_d.cpp
File metadata and controls
49 lines (38 loc) · 950 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
#include <iostream>
using namespace std;
#include <algorithm>
template <typename key_t, typename priorities_t>
class Treap_t
{
private:
pair<key_t, priorities_t> node_val;
Treap_t *left_n;
Treap_t *right_n;
//copy, assignment and dtor
public:
Treap_t(key_t key, priorities_t prior, Treap_t *left_n = NULL, Treap_t* right_n = NULL)
:
node_val(key, prior),left_n(left_n), right_n(right_n)
{
}
friend ostream& operator<<(ostream &o, const Treap_t<key_t, priorities_t> &rhs)
{
o << "Key: " << rhs.node_val.first << "\n";
o << "Priority: " << rhs.node_val.second << "\n";
return o;
}
void insert_bst(Treap_t *root, key_t key, priorities_t prior)
{
//tree is empty
if(root == NULL)
{
root = new Treap_t<key_t,priorities_t>()
}
}
};
int main()
{
cout<<"test\n";
Treap_t<int,int>t1(1,2);
cout<<t1;
}