数据结构
文章平均质量分 78
HappyWu
这个作者很懒,什么都没留下…
展开
-
BST 二叉搜索树 非指针版
BST BST即为binarysearch tree 二叉搜索树为平衡树的基础,所以很要学习的必要。 BST的结点满足一个基本条件就是:结点k的左子树中所有值小于结点k的值,结点k的右子树的所有值大于结点k的值,显然这是一个递归定义的结构。 这个结构就使得中序遍历出来的序列即是一个升序的序列。一个优秀的二叉搜索树能够在log(n)的时间内进行查找、删除一个元素等。原创 2014-03-07 18:34:31 · 884 阅读 · 0 评论 -
CF 【树状数组】461C. Appleman and a Sheet of Paper
/*此题操作麻烦之处就是可能折叠过去后超过当前的右边界 * 如果超过右边界可以等效为将右边的向左折,相当于翻转了一次,标记rev=1, * 下次再进行折叠操作的时候就看成起始端在右边 * */#include#includeusing namespace std;const int maxn = 100000+10;int n,q;int l,r,c[maxn],type;i原创 2014-09-04 16:53:01 · 529 阅读 · 0 评论 -
【Splay】BZOJ 1588 [HNOI2002]营业额统计
用splay的基本操作Find_pre和Find_s#include#include#includeusing namespace std;const int maxint = 214748364;const int MAX_N = 40000;//0表示空结点NULLstruct Node{ int key,num,fa; int son[2];}Tree[MA原创 2014-08-13 14:34:52 · 527 阅读 · 0 评论 -
【splay】【树状数组】 BZOJ 1503 [NOI2004]郁闷的出纳员
/************************************************************** Problem: 1503 User: 704035233 Language: C++ Result: Accepted Time:868 ms Memory:6348 kb************************原创 2014-08-13 20:44:24 · 534 阅读 · 0 评论 -
【Splay】 1208 [HNOI2004]宠物收养所
/************************************************************** Problem: 1208 User: 704035233 Language: C++ Result: Accepted Time:136 ms Memory:3236 kb************************原创 2014-08-14 22:16:42 · 488 阅读 · 0 评论 -
【Splay】POJ 3468 A Simple Problem with Integers
/*happywu * 2014.8.15 * poj 3468 * Splay */#include#includeusing namespace std;typedef long long LL;const int maxn=100000+10;struct Node{ int key,Size,num,fa,son[2]; LL sum,lazy;}Tree[ma原创 2014-08-15 17:39:29 · 421 阅读 · 0 评论 -
【线段树 Splay】 hdu 1754 I Hate It
线段树/*happywu * hdu 1754 * 2014.8.14 */#include#includeusing namespace std;const int maxn=200000+10;struct Node{ int key,Max;}Tree[maxn*4];int n,A[maxn],m,l,r,x;char com=0;inline void P原创 2014-08-15 13:57:20 · 345 阅读 · 0 评论