Treap树各种操作
摘要:
今天写了Treap树的各种操作。。1.插入元素2.删除元素3.查找元素4.求第K小元素5确定一个元素秩6求最大值7求最小值8遍历View Code #include <stdio.h>#include <string.h>#include <stdlib.h>#include <time.h>typedef struct node{ node *lchild, *rchild, *pf;//左孩子,右孩子 int v, pri, size;//值和优先值}*Node;void update( Node &q ){ if( q->rc 阅读全文
posted @ 2012-03-03 21:53 more think, more gains 阅读(256) 评论(0) 推荐(0) 编辑