Skip to content

Commit c36f96f

Browse files
authored
Init type
1 parent 0cc3c84 commit c36f96f

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Data Structures/Treap/treap.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#include <bits/stdc++.h>
2+
using namespace std;
3+
4+
typedef struct node{
5+
int val,prior,size;
6+
struct node *l,*r;
7+
} node;
8+
9+
typedef node* pnode;
10+
11+
int sz(pnode t){
12+
return t ? t->size : 0;
13+
}
14+
15+
pnode init(int val){
16+
pnode ret = (pnode)malloc(sizeof(node));
17+
ret->val=val;
18+
ret->size=1;
19+
ret->prior=rand();
20+
ret->l=ret->r=NULL;
21+
return ret;
22+
}

0 commit comments

Comments
 (0)