- 13
- 0
- 约1.67万字
- 约 35页
- 2016-08-15 发布于河南
- 举报
北航C教程
* * * * * * * * * 5.3.2 Randomly permuting an array (2) RANDOMIZE-IN-PLACE RANDOMIZE-IN-PLACE(A, n) for(i=1; i=n; i++) swap(A[i], A[RANDOM(i, n)] Lemma RANDOMIZE-IN-PLACE computes a uniform random permutation. Proof Loop invariant: Pr{A[1 .. i-1] contains each (i-1)-permutation} = (n-i+1)!/n! . Maintenance: … … i-permutation R=x1, x2, … , xi = x1, x2, … , xi ∪ xi = R’ ∪ xi . Let E1 be the event that the algorithm actually puts R’ into A[1 .. i-1] . By the loop invariant, Pr{E1}=(n-i+1)!/n! . Let E2 be the event that the ith iteration puts xi into A[i]. We get the i-Permutation R in
您可能关注的文档
最近下载
- 地铁区间高架桥施工安全风险评估及改进方案.docx VIP
- 变电站一键顺控改造技术规范(试行).docx VIP
- 照明工程设计收费标准---T-CIES002-2016.pdf VIP
- 湖南省新高考教学教研联盟(长郡二十校联盟)2026届高三下学期3月联考试题 化学 含解析.docx VIP
- 正弦函数的图像-精品.ppt VIP
- 《GB_T 36719-2018图书馆视障人士服务规范》专题研究报告.pptx VIP
- 铁路隧道二次衬砌预防拱顶空洞实施意见,工管桥隧函[2015]199号.pdf VIP
- (正式版)H-G-T 22820-2024 化工安全仪表系统工程设计规范.docx VIP
- (4月15日)守国安底线,筑安全长城——2026年全民国家安全教育日主题班会.pptx
- 2026年企业战略管理试题及答案.doc VIP
原创力文档

文档评论(0)