当前位置:首页 » 编程博文
开发技术指南» 文章正文
    引言: 求最短路径的Dijkstra算法: Dijkstra算法是一种解
 

 

    摘要:1.3 算法和算法分析algorithms and algorithm analysis 1.3.1算法 所谓算法(algorithm)是对问题求解步骤的一种描述,是指令的有限序列,其中每一条指令表示一个或多个操作。在clrs中是这样给出算法的定义的:informally, an algorithm is any well-defined computational procedure that ......
    摘要:在对http服务器提交请求时如果url中含有中文字符,希望asp页面接收到的仍然是正常的中文字符,而不会是乱码 做法就是把url字符串encode一下,以前就有人写过在vc中的实现见 http://blog.csdn.net/zhengyun_ustc/archive/2002/05/20/12654.aspx但是它的只能在vc中运行,有一定的限制,因此我改写了一下.代码如下:inline byt......


组合算法概论(3)
求最短路径的dijkstra算法:

dijkstra算法是一种解决最短路径问题的非常有效的算法,时间复杂度为 o(│v│2),下面是一段精确的描述(本段引自mit的课程主页,不翻译了,保持原作)中文描述一般的书上都会有: 【程序编程相关:VB中常用的数据类型和C#中数据类型的对

【推荐阅读:由励志书籍的泛滥和良莠不齐想到的

1. set i=0, s0= {u0=s}, l(u0)=0, and l(v)=infinity for v <> u0. if │v│ = 1 then stop, otherwise go to step 2. 【扩展信息:我做过的项目

2. for each v in v\si, replace l(v) by min{l(v), l(ui)+dvui}. if l(v) is replaced, put a label (l(v), ui) on v.

3. find a vertex v which minimizes {l(v): v in v\si}, say ui+1.

4. let si+1 = si cup {ui+1}.

5. replace i by i+1. if i=│v?1 then stop, otherwise go to step 2.

6. set i=0, s0= {u0=s}, l(u0)=0, and l(v)=infinity for v <> u0. if │v│ = 1 then stop, otherwise go to step 2.

7. for each v in v\si, replace l(v) by min{l(v), l(ui)+dvui}. if l(v) is replaced, put a label (l(v), ui) on v.

8. find a vertex v which minimizes {l(v): v in v\si}, say ui+1.

9. let si+1 = si cup {ui+1}.

10. replace i by i+1. if i=│v│-1 then stop, otherwise go to step 2.

求二部图最大匹配(指派问题)的匈牙利算法:

谈匈牙利算法自然避不开hall定理,即是:对于二部图g,存在一个匹配m,使得x的所有顶点关于m饱与的充要条件是:对于x的任意一个子集a,与a邻接的点集为t(a),恒有: │t(a)│ >= │a│

匈牙利算法是基于hall定理中充分性证明的思想,其基本步骤为:

1.任给初始匹配m;

2.若x已饱与则结束,否则进行第3步;

3.在x中找到一个非饱与顶点x0,作v1 ← {x0},  v2 ← φ;

4.若t(v1) = v2则因为无法匹配而停止,否则任选一点y ∈t(v1)\v2;

5.若y已饱与则转6,否则做一条从x0 →y的可增广道路p,m←m⊕e(p),转2;

6.由于y已饱与,所以m中有一条边(y,z),作 v1 ← v1 ∪{z}, v2 ← v2 ∪ {y}, 转4;

关于求网络最大流与最小割的标号算法:

给定一个有向图g=(v,e),把图中的边看作管道,每条边上有一个权值,表示该管道的流量上限.给定源点s与汇点t,现在假设在s处有一个水源,t处有一个蓄水池,问从s到t的最大水流量是多少.这就叫做网络流问题.用数学语言描述就是:


...   下一页
 ·hivemind, pico, spring ioc    »显示摘要«
    摘要:http://www.jdon.com/jive/thread.jsp?forum=91&thread=17578&start=0&msrange=15http://www.pyrasun.com/mike/mt/archives/2004/11/06/15.46.14/index.html这里讨论了三种ioc container,分析得很好! ......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE