typedef struct treap_node_t treap_node_t; struct treap_node_t { /* left child */ treap_node_t *left; /* right child */ treap_node_t *right; /* priority that will be randomly set at insertion */ int priority; /* the key of the node which will also be used for sorting */ void *key; }; typedef struct treap_t treap_t; struct treap_t { /* root of the tree */ treap_node_t *root; /* function used for comparing the keys */ int (*cmp)(const void *key1, const void *key2); };