![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法
文章平均质量分 52
yc5_yc
这个作者很懒,什么都没留下…
展开
-
树状数组
树状数组支持部分线段树的操作。主要工作:求前缀和lowbit函数:f(x)=x&(x^(x-1)) 负责转移习题:SPOJ NKTEAM 详见PDF POJ 3321 求后序遍历二叉树顺序,子树即为前面的N项(N为包括自己的子节点个数)原创 2012-08-26 17:55:48 · 334 阅读 · 0 评论 -
用Python实现的基本版的线段树
class node: def __init__(self,x,y): self.l=x self.r=y self.key=0 if x mid=(x+y)/2 self.left=node(x,mid) self.right=node(原创 2012-11-26 20:57:04 · 1715 阅读 · 0 评论 -
完整版线段树求最小值,支持区间减
def Min(a,b): if a return a else: return bclass node: def __init__(self,x,y): self.l=x self.r=y self.key=0 self.lazy=0 i原创 2012-11-26 21:45:27 · 543 阅读 · 0 评论 -
Haskell线段树建树
调了一晚上……data Tree=Tree Int Int [Tree] [Tree]|Empty deriving (Show)build :: (Int,Int)->Treebuild (x,y)=if x<y then Tree x y [build (x,(div (x+y) 2))] [build ((div (x+y) 2)+1,y)] else Tree x y [Emp原创 2012-11-30 22:23:47 · 722 阅读 · 0 评论 -
stoer wagner代码
合并的代码很容易写错!#include #include #include #include using namespace std;const int NMax=550;int N,M,G[NMax][NMax],dist[NMax],map[NMax];bool inA[NMax];int Dinic() {//1.min=MAXINT,固定一个顶点P原创 2013-01-13 13:40:37 · 409 阅读 · 0 评论 -
AVL树代码
这个代码输出了map与我的AVL效率的差异,明显AVL快。#include #include #include using namespace std;const int NMax=1000000;templatestruct node{ KEY k;DATA d; int h; node *left,*right;};#define HIGH(_)原创 2013-01-16 18:30:52 · 404 阅读 · 0 评论