高级算法
合集下载
相关主题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Harmonic number H(n) 调和数
Harmonic number H(n) 调和数
An integral representation by Euler 欧拉的积分描述:
γ- Euler–Mascheroni constant 0.5772156649...
Randomized quick sort 随机快速排序
Leabharlann Baidu
Requirements 课程要求
Usual performance 平时成绩 (50%)
- class-tests & homework 课堂测试与作业 课堂测试当堂完成 - project report 项目实践报告 允许合作,但须明确分工
- keynote speech (optional) 算法主题讲解(可选) 10~15分/次
That‟s the Ford-Fulkerson Alg. Efficiency: every iteration – O(|E|) But how many iterations? 保证了每次迭代的效率,问题是 迭代次数多大
Review: Max-Flow & Min-Cut 最小割-最大流问题
Basic analysis of algorithms 基本分析:
time&space complexity, big-O,Ω,Θ, P&NP class…
Techniques 算法技术:
divide&conquer分治法, greedy贪婪法, recursion递归, backtracking回溯, branch&bound分支界定, dynamic programming动态规划, linear programming线性规划…
Bound the expected number of comparisons C 关键:对比较次数C的界定 Xij = 1 if i j are compared,全部加起来就是比较次数 C = ΣXij , i:[1,n-1] j:[i+1,n] linearity of expectation 数学期望是线性的,分解为每 个i, j比较次数的期望: E[C] = ΣE[Xij ] E[Xij ] = pij
J. Nocedal, S. J. Wright: "Numerical Optimization" S. Dasgupta, C. H. Papadimitriou, and U. V. Vazirani: "Algorithms", McGraw-Hill
Research resources
Start with zero flow. 从0流量开始 Repeat: choose an appropriate path from s to t, and increase flow along the edges of this path as much as possible. 选择合适路 径,尽可能增加流量
The aim:
speed, simplicity and proof 算法的效率、简单化及可验证
Review 回顾
Basic data structures 基本数据结构:
set, array, matrix, stacks, queues, linked lists, rooted trees, binary search trees, hash tables, graph...
Review: Max-Flow & Min-Cut 最小割-最大流问题
Max-flow min-cut theorem 最大流最小割定理:
The size of the max-flow in a network equals the capacity of the smallest (s,t) - cut. 网络两点间的最 大流等于分割该两点需要的最小割量。 任意最小割则考察所有两点间的最小割
Randomized quick sort 随机快速排序
Consider the smallest recursive call involving both i and j. Pivot (比较元素,支点) must be one of sorted sequence Si, …, Sj. They are all equally likely. 考察可能包含i, j比较的递归调用,比较点只能在它们 之间,每种情况的可能性相等。
Question: What would happen if a picked pivot is less or greater than both Si and Sj?
Randomized quick sort 随机快速排序
They would be compared only if the pivot is Si or Sj 只有它俩之一被挑做比较点才可能相互比较 probability is 2/(j-i+1), 这是i, j比较次数的概率或期望 Analysis:
Review: Max-Flow & Min-Cut 最小割-最大流问题
A directed graph G = (V,E) , two special nodes s, t ∈V , source and sink of G; and capacities ce > 0 on the edges 有向图,源点和汇点,及每条边的容量权重,满足条件: 1. 0 ≤fe ≤ce 每边不超容量 2. For all nodes u except s and t, the amount of flow entering u equals the amount leaving u 对一个节点,出入量相等
Problem solving 问题解决:
counting计数, sorting排序, searching搜索, matching匹配, satisfactory可满足性, optimization优化, graph theory图论, network flow网络流 …
Review 回顾
Basic mathematic techniques 基本数学工具:
Improvement 改进: Edmonds-Karp Alg. Breadth-first to find shortest path of the residual network with no capacity 不考虑流量对残留网进行广度优先搜索 δf (u,v) the shortest-path distance from u to v in Gf 由此定义两点间的最短距离
Residual network 残留网: 1. (u,v) is in the original network, and is not yet at full capacity. 一条边在原有网络中且尚未 满负荷,则未满部分在残留网中 2. The reverse edge (v,u) is in the original network, and there is some flow along it. (cancel existing flow) 原有网络中的边在残 留网中反向,也即该边的流量可能被去除
Advanced Algrithms 高级算法
华东师范大学计算机科学技术系 石东昱 dyshi@cs.ecnu.edu.cn
Motivation 课程主旨
Why advanced algorithm?
- polynomial time exact algorithms not known 一些问题可 能没有多项式时间的算法 - problems under stringent resource constraints 一些问题 的解决可能受到严厉的资源 (计算、存储)限制 Designing efficient algorithms with provable guarantees on their performance 需要设计更有效的算法,具有可证 明的对效率的保证
Final exam 期末考试 (50%) :
闭卷考
Randomized quick sort 随机快速排序
Items S1,…, Sn are to be sorted Suppose we could always pick the middle element: T(n) = 2T(n/2) + O(n) = O(n log n) A problem is always divided into exponentially smaller sub-problems. 只要能总是选到中间的元素,上式就总 能成立。
Picking the middle is hard. But an almost middle one is acceptable. 不是正中间,接近中间也是可以的。 Pick a random element “probably” near the middle and dividing the problem by two parts. 随机选择元素,以概 率接近中点,将问题分解。
Randomized quick sort 随机快速排序
Strategy: pick a random element, comparing it to other elements in the group, and then sort both divided parts. 策略就是在每一步中随机选择比较元素
Text books & References 教材及参考书
R. Motwani, P. Raghavan: " Randomized Algorithms", Cambridge University Press, 1995. M. Mitzenmacher, E. Upfal: “Probability and Computing: Randomized Algorithms and Probabilistic Analysis", Cambridge University Press, 2005.
O (n log n)
Analysis holds for every input, doesn„t assume random input 对任何输入成立,未假设随机输入
We proved the expectation, actually with high probability 对其数学期望进行了证明,还可以证 明大概率下任何输入都是 O (n log n) How did we pick a random elements? Depends on model. 如何随机挑选元素取决于具体模型 The algorithm always works, but might be slow. 算法总能运行,但仍可能较慢
ACM Transactions on Algorithms Journal of the ACM Journal of Algorithms Annual ACM Symposium on Theory of Computing (STOC) IEEE Symposium on Foundations of Computer Science (FOCS) ACM-SIAM Symposium on Discrete Algorithms (SODA) Advances in Neural Information Processing Systems (NIPS)
- Differentiation and integration on single and multiple variables 一元与多元微积分; - Probability and statistics 概率统计;
- Linear algebra 线性代数;
Contents 课程内容
Randomized algorithms 随机算法 Probability analysis 概率分析 Sampling algorithms 采样算法 Approximation, optimization 近似、优化