<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://tcs.nju.edu.cn/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Kvrmnks</id>
	<title>TCS Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://tcs.nju.edu.cn/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Kvrmnks"/>
	<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=Special:Contributions/Kvrmnks"/>
	<updated>2026-04-28T16:34:40Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=%E6%95%B0%E6%8D%AE%E7%A7%91%E5%AD%A6%E5%9F%BA%E7%A1%80_(Fall_2025)&amp;diff=13233</id>
		<title>数据科学基础 (Fall 2025)</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=%E6%95%B0%E6%8D%AE%E7%A7%91%E5%AD%A6%E5%9F%BA%E7%A1%80_(Fall_2025)&amp;diff=13233"/>
		<updated>2025-08-19T07:19:51Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: /* Course info */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox&lt;br /&gt;
|name         = Infobox&lt;br /&gt;
|bodystyle    = &lt;br /&gt;
|title        = &amp;lt;font size=3&amp;gt;&#039;&#039;&#039;数据科学基础&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Foundations of Data Science&lt;br /&gt;
|titlestyle   = &lt;br /&gt;
&lt;br /&gt;
|image        = &lt;br /&gt;
|imagestyle   = &lt;br /&gt;
|caption      = &lt;br /&gt;
|captionstyle = &lt;br /&gt;
|headerstyle  = background:#ccf;&lt;br /&gt;
|labelstyle   = background:#ddf;&lt;br /&gt;
|datastyle    = &lt;br /&gt;
&lt;br /&gt;
|header1 =Instructor&lt;br /&gt;
|label1  = &lt;br /&gt;
|data1   = &lt;br /&gt;
|header2 = &lt;br /&gt;
|label2  = &lt;br /&gt;
|data5   = &#039;&#039;&#039;刘明谋&#039;&#039;&#039;&lt;br /&gt;
|header6 = &lt;br /&gt;
|label6  = Email&lt;br /&gt;
|data6   = lmm@nju.edu.cn&lt;br /&gt;
|header7 =&lt;br /&gt;
|label7  = office&lt;br /&gt;
|data7   = 南雍-西229&lt;br /&gt;
|header8 = Class&lt;br /&gt;
|label8  = &lt;br /&gt;
|data8   = &lt;br /&gt;
|header9 =&lt;br /&gt;
|label9  = Class meeting&lt;br /&gt;
|data9   = 周五, 2pm-5pm &amp;lt;br/&amp;gt;苏教楼C204&lt;br /&gt;
|header10=&lt;br /&gt;
|label10 = Office hour&lt;br /&gt;
|data10  = 周四, 3pm-5pm&amp;lt;br/&amp;gt;南雍-西229&lt;br /&gt;
|header11= Textbook&lt;br /&gt;
|label11 = &lt;br /&gt;
|data11  = &lt;br /&gt;
|header12=&lt;br /&gt;
|label12 = &lt;br /&gt;
|data12  = [[File:概率导论.jpeg|border|100px]]&lt;br /&gt;
|header13=&lt;br /&gt;
|label13 = &lt;br /&gt;
|data13  = &#039;&#039;&#039;概率导论&#039;&#039;&#039;（第2版·修订版）&amp;lt;br&amp;gt; Dimitri P. Bertsekas and John N. Tsitsiklis&amp;lt;br&amp;gt; 郑忠国 童行伟 译；人民邮电出版社 (2022)&lt;br /&gt;
|header14=&lt;br /&gt;
|label14 = &lt;br /&gt;
|data14  = [[File:Probability_and_Computing_2ed.jpg|border|100px]]&lt;br /&gt;
|header15=&lt;br /&gt;
|label15 = &lt;br /&gt;
|data15  = &#039;&#039;&#039;Probability and Computing&#039;&#039;&#039; (2E) &amp;lt;br&amp;gt; Michael Mitzenmacher and Eli Upfal &amp;lt;br&amp;gt;   Cambridge University Press (2017)&lt;br /&gt;
|header16=&lt;br /&gt;
|label16 = &lt;br /&gt;
|data16  = [[File:Foundations_of_Data_Science.jpg|border|100px]]&lt;br /&gt;
|header17= &lt;br /&gt;
|label17 = &lt;br /&gt;
|data17  = &#039;&#039;&#039;Foundations of Data Science&#039;&#039;&#039; &amp;lt;br&amp;gt; Avrim Blum, John Hopcroft, Ravi Kannan &amp;lt;br&amp;gt;   Cambridge University Press (2020)&lt;br /&gt;
|belowstyle = background:#ddf;&lt;br /&gt;
|below = &lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
This is the webpage for the &#039;&#039;Foundations of Data Science&#039;&#039; (数据科学基础) class of Fall 2025. Students who take this class should check this page periodically for content updates and new announcements. &lt;br /&gt;
&lt;br /&gt;
= Announcement =&lt;br /&gt;
* 新学期第一堂课：2025年8月29日，苏教楼C204。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Course info =&lt;br /&gt;
* &#039;&#039;&#039;Instructor &#039;&#039;&#039;: &lt;br /&gt;
** [https://liumingmou.github.io 刘明谋]：[mailto:lmm@nju.edu.cn &amp;lt;lmm@nju.edu.cn&amp;gt;]，南雍-西229&lt;br /&gt;
* &#039;&#039;&#039;Teaching assistant&#039;&#039;&#039;:&lt;br /&gt;
** 梁梓豪：[mailto:zhliang@smail.nju.edu.cn] 仙林校区计科楼北栋426 &lt;br /&gt;
** 周海刚：[mailto:hgzhou2003@outlook.com 📧] 仙林校区计科楼北栋410&lt;br /&gt;
** 欧丰宁：[mailto:oufn02@outlook.com 📧] 仙林校区计科楼北栋410&lt;br /&gt;
** 于逸潇：[mailto:yixiaoyu@smail.nju.edu.cn 📧] 仙林校区计科楼北栋410&lt;br /&gt;
** 缪天顺：[mailto:*@smail.nju.edu.cn] 仙林校区计科楼北栋426 &lt;br /&gt;
* &#039;&#039;&#039;Class meeting&#039;&#039;&#039;:&lt;br /&gt;
** 周五：2pm-5pm，苏教楼C204&lt;br /&gt;
* &#039;&#039;&#039;Office hour&#039;&#039;&#039;: &lt;br /&gt;
:* 周四：3pm-5pm，南雍-西229（刘明谋）&lt;br /&gt;
:* &#039;&#039;&#039;QQ群&#039;&#039;&#039;: 1019436733（申请加入需提供姓名、院系、学号）&lt;br /&gt;
&lt;br /&gt;
= Syllabus =&lt;br /&gt;
课程内容分为三大部分：&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;经典概率论&#039;&#039;&#039;：包括概率空间、随机变量及其数字特征、多维与连续随机变量&lt;br /&gt;
* &#039;&#039;&#039;概率与计算&#039;&#039;&#039;：包括测度集中现象，概率法，离散随机过程三部分&lt;br /&gt;
* &#039;&#039;&#039;数理统计&#039;&#039;&#039;：包括参数估计、假设检验、贝叶斯估计、方差分析、相关性及回归分析等统计推断内容。&lt;br /&gt;
&lt;br /&gt;
对于第一和第二部分，要求清楚掌握基本概念，深刻理解关键的现象与规律以及背后的原理，并可以灵活运用所学方法求解相关问题。对于第三部分，要求熟悉数理统计相关的基本概念，以及典型的统计模型、统计推断方法。&lt;br /&gt;
&lt;br /&gt;
经过本课程的训练，学生将能够掌握概率论和统计学的基本理论和方法，具备处理和分析实际数据的能力，为后续学习数据挖掘、机器学习、大数据技术等数据科学相关领域打下坚实基础。本课程采用课堂讲授、案例分析和课后练习相结合的教学方式，注重理论与实践相结合，培养学生运用所学知识解决实际问题的能力。通过本课程的学习，学生将能够具备扎实的数学基础，为未来从事数据科学研究和实践奠定坚实基础。&lt;br /&gt;
&lt;br /&gt;
=== 教材与参考书 Course Materials ===&lt;br /&gt;
* &#039;&#039;&#039;[BT]&#039;&#039;&#039; 概率导论（第2版·修订版），[美]伯特瑟卡斯（Dimitri P.Bertsekas）[美]齐齐克利斯（John N.Tsitsiklis）著，郑忠国 童行伟 译，人民邮电出版社（2022）。&lt;br /&gt;
* &#039;&#039;&#039;[MU]&#039;&#039;&#039; &#039;&#039;Probability and Computing: Randomization and Probabilistic Techniques in Algorithms and Data Analysis&#039;&#039;, by Michael Mitzenmacher, Eli Upfal; Cambridge University Press; 2nd edition (2017).&lt;br /&gt;
* &#039;&#039;&#039;[GS]&#039;&#039;&#039; &#039;&#039;Probability and Random Processes&#039;&#039;, by Geoffrey Grimmett and David Stirzaker; Oxford University Press; 4th edition (2020).&lt;br /&gt;
* &#039;&#039;&#039;[BHK]&#039;&#039;&#039; &#039;&#039;Foundations of Data Science&#039;&#039;, by Avrim Blum, John Hopcroft, and Ravindran Kannan; Cambridge University Press (2020).&lt;br /&gt;
&lt;br /&gt;
=== 成绩 Grading Policy ===&lt;br /&gt;
* 课程成绩：本课程将会有若干次作业和一次期末考试。最终成绩将由平时作业成绩和期末考试成绩综合得出。&lt;br /&gt;
* 迟交：如果有特殊的理由，无法按时完成作业，请提前联系授课老师，给出正当理由。否则迟交的作业将不被接受。&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font color=red&amp;gt; 学术诚信 Academic Integrity &amp;lt;/font&amp;gt;===&lt;br /&gt;
学术诚信是所有从事学术活动的学生和学者最基本的职业道德底线，本课程将不遗余力的维护学术诚信规范，违反这一底线的行为将不会被容忍。&lt;br /&gt;
&lt;br /&gt;
作业完成的原则：&#039;&#039;&#039;署你名字的工作必须是你个人的贡献，作业中必须明确标注任何不是由你完成的部分&#039;&#039;&#039;，特别是由AI生成的部分，否则就涉嫌抄袭。在完成作业的过程中，允许讨论，前提是讨论的所有参与者均处于同等完成度。但关键想法的执行、以及作业文本的写作必须独立完成，并在作业中致谢（acknowledge）所有参与讨论的人。符合规则的讨论与致谢将不会影响得分。不允许其他任何形式的合作——尤其是与已经完成作业的同学“讨论”。&lt;br /&gt;
&lt;br /&gt;
本课程将对剽窃行为采取零容忍的态度。在完成作业过程中，对他人工作（出版物、互联网资料、其他人的作业等）直接的文本抄袭和对关键思想、关键元素的抄袭，按照 [http://www.acm.org/publications/policies/plagiarism_policy ACM Policy on Plagiarism]的解释，都将视为剽窃。剽窃者成绩将被取消。如果发现互相抄袭行为，&amp;lt;font color=red&amp;gt; 抄袭和被抄袭双方的成绩都将被取消&amp;lt;/font&amp;gt;。因此请主动防止自己的作业被他人抄袭。&lt;br /&gt;
&lt;br /&gt;
学术诚信影响学生个人的品行，也关乎整个教育系统的正常运转。为了一点分数而做出学术不端的行为，不仅使自己沦为一个欺骗者，也使他人的诚实努力失去意义。让我们一起努力维护一个诚信的环境。&lt;br /&gt;
&lt;br /&gt;
= Assignments =&lt;br /&gt;
*TBA&lt;br /&gt;
&lt;br /&gt;
= Lectures =&lt;br /&gt;
# TBA&lt;br /&gt;
&lt;br /&gt;
= Concepts =&lt;br /&gt;
* [https://plato.stanford.edu/entries/probability-interpret/ Interpretations of probability]&lt;br /&gt;
* [https://en.wikipedia.org/wiki/History_of_probability History of probability]&lt;br /&gt;
* Example problems:&lt;br /&gt;
** [https://dornsifecms.usc.edu/assets/sites/520/docs/VonNeumann-ams12p36-38.pdf von Neumann&#039;s Bernoulli factory] and other [https://peteroupc.github.io/bernoulli.html Bernoulli factory algorithms]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Boy_or_Girl_paradox Boy or Girl paradox]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Monty_Hall_problem Monty Hall problem]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Bertrand_paradox_(probability) Bertrand paradox]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Hard_spheres Hard spheres model] and [https://en.wikipedia.org/wiki/Ising_model Ising model]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/PageRank &#039;&#039;PageRank&#039;&#039;] and stationary [https://en.wikipedia.org/wiki/Random_walk random walk]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Diffusion_process Diffusion process] and [https://en.wikipedia.org/wiki/Diffusion_model diffusion model]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Probability_space Probability space]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Sample_space Sample space]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Event_(probability_theory) Event] and [https://en.wikipedia.org/wiki/Σ-algebra &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;-algebra]&lt;br /&gt;
** Kolmogorov&#039;s [https://en.wikipedia.org/wiki/Probability_axioms axioms of probability]&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Discrete_uniform_distribution Classical] and [https://en.wikipedia.org/wiki/Geometric_probability goemetric probability]&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Boole%27s_inequality Union bound]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Inclusion%E2%80%93exclusion_principle Inclusion-Exclusion principle]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Boole%27s_inequality#Bonferroni_inequalities Bonferroni inequalities]&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Conditional_probability Conditional probability]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Chain_rule_(probability) Chain rule]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Law_of_total_probability Law of total probability]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Bayes%27_theorem Bayes&#039; law]&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Independence_(probability_theory) Independence] &lt;br /&gt;
** [https://en.wikipedia.org/wiki/Pairwise_independence Pairwise independence]&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Random_variable Random variable]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Cumulative_distribution_function Cumulative distribution function]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Probability_mass_function Probability mass function]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Probability_density_function Probability density function]&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Multivariate_random_variable Random vector]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Joint_probability_distribution Joint probability distribution]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Conditional_probability_distribution Conditional probability distribution]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Marginal_distribution Marginal distribution]&lt;br /&gt;
* Some &#039;&#039;&#039;discrete&#039;&#039;&#039; probability distributions&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Bernoulli_trial Bernoulli trial] and [https://en.wikipedia.org/wiki/Bernoulli_distribution Bernoulli distribution]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Discrete_uniform_distribution Discrete uniform distribution]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Binomial_distribution Binomial distribution]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Geometric_distribution Geometric distribution]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Negative_binomial_distribution Negative binomial distribution]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Hypergeometric_distribution Hypergeometric distribution]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Poisson_distribution Poisson distribution]&lt;br /&gt;
** and [https://en.wikipedia.org/wiki/List_of_probability_distributions#Discrete_distributions others]&lt;br /&gt;
* Balls into bins model&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Multinomial_distribution Multinomial distribution]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Birthday_problem Birthday problem]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Coupon_collector%27s_problem Coupon collector]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Balls_into_bins_problem Occupancy problem]&lt;br /&gt;
* Random graphs&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Erd%C5%91s%E2%80%93R%C3%A9nyi_model Erdős–Rényi random graph model]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Galton%E2%80%93Watson_process Galton–Watson branching process]&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Expected_value Expectation]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Law_of_the_unconscious_statistician Law of the unconscious statistician, &#039;&#039;LOTUS&#039;&#039;]&lt;br /&gt;
** [https://dlsun.github.io/probability/linearity.html Linearity of expectation]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Conditional_expectation Conditional expectation]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Law_of_total_expectation Law of total expectation]&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=%E8%AE%A1%E7%AE%97%E6%96%B9%E6%B3%95Numerical_method_(Spring_2025)/Homework6_%E6%8F%90%E4%BA%A4%E5%90%8D%E5%8D%95&amp;diff=13165</id>
		<title>计算方法Numerical method (Spring 2025)/Homework6 提交名单</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=%E8%AE%A1%E7%AE%97%E6%96%B9%E6%B3%95Numerical_method_(Spring_2025)/Homework6_%E6%8F%90%E4%BA%A4%E5%90%8D%E5%8D%95&amp;diff=13165"/>
		<updated>2025-05-21T07:21:28Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: Created page with &amp;quot; 如有错漏请邮件联系助教. &amp;lt;center&amp;gt; {| class=&amp;quot;wikitable&amp;quot; |- ! 学号 !! 姓名 |- | 221220090 || 周思桥  |- | 221240002 || 季悦宁  |- | 221240040 || 郑雯琪  |- | 231098068 || 戎昱  |- | 231098091 || 刘棣文  |- | 231098166 || 陈展  |- | 231200035 || 葛翰飞  |- | 231220036 || 周楚函  |- | 231220065 || 劳汉显  |- | 231220067 || 黄裕书琪  |- | 231220071 || 吴江涛  |- | 231220122 || 安琦煜  |- | 231220166 || 苏易  |- | 231220171 |...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; 如有错漏请邮件联系助教.&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 学号 !! 姓名&lt;br /&gt;
|-&lt;br /&gt;
| 221220090 || 周思桥 &lt;br /&gt;
|-&lt;br /&gt;
| 221240002 || 季悦宁 &lt;br /&gt;
|-&lt;br /&gt;
| 221240040 || 郑雯琪 &lt;br /&gt;
|-&lt;br /&gt;
| 231098068 || 戎昱 &lt;br /&gt;
|-&lt;br /&gt;
| 231098091 || 刘棣文 &lt;br /&gt;
|-&lt;br /&gt;
| 231098166 || 陈展 &lt;br /&gt;
|-&lt;br /&gt;
| 231200035 || 葛翰飞 &lt;br /&gt;
|-&lt;br /&gt;
| 231220036 || 周楚函 &lt;br /&gt;
|-&lt;br /&gt;
| 231220065 || 劳汉显 &lt;br /&gt;
|-&lt;br /&gt;
| 231220067 || 黄裕书琪 &lt;br /&gt;
|-&lt;br /&gt;
| 231220071 || 吴江涛 &lt;br /&gt;
|-&lt;br /&gt;
| 231220122 || 安琦煜 &lt;br /&gt;
|-&lt;br /&gt;
| 231220166 || 苏易 &lt;br /&gt;
|-&lt;br /&gt;
| 231220171 || 刘正阳 &lt;br /&gt;
|-&lt;br /&gt;
| 231220176 || 罗皓然 &lt;br /&gt;
|-&lt;br /&gt;
| 231220179 || 徐钰炜 &lt;br /&gt;
|-&lt;br /&gt;
| 231230102 || 庄铸锴 &lt;br /&gt;
|-&lt;br /&gt;
| 231240002 || 余孟凡 &lt;br /&gt;
|-&lt;br /&gt;
| 231240004 || 何梓杨 &lt;br /&gt;
|-&lt;br /&gt;
| 231240009 || 陈心怡 &lt;br /&gt;
|-&lt;br /&gt;
| 231240011 || 陈力琰 &lt;br /&gt;
|-&lt;br /&gt;
| 231240013 || 南晨曦 &lt;br /&gt;
|-&lt;br /&gt;
| 231240016 || 徐冰冰 &lt;br /&gt;
|-&lt;br /&gt;
| 231240018 || 渠翔凯 &lt;br /&gt;
|-&lt;br /&gt;
| 231240027 || 彭浩楠 &lt;br /&gt;
|-&lt;br /&gt;
| 231240029 || 朱非凡 &lt;br /&gt;
|-&lt;br /&gt;
| 231240038 || 肖金宇 &lt;br /&gt;
|-&lt;br /&gt;
| 231240045 || 杨俊炜 &lt;br /&gt;
|-&lt;br /&gt;
| 231240047 || 姜淮仁 &lt;br /&gt;
|-&lt;br /&gt;
| 231240051 || 王昱霏 &lt;br /&gt;
|-&lt;br /&gt;
| 231240053 || 王艺文 &lt;br /&gt;
|-&lt;br /&gt;
| 231240056 || 靳濡搏 &lt;br /&gt;
|-&lt;br /&gt;
| 231502012 || 许立恒 &lt;br /&gt;
|-&lt;br /&gt;
| 231502013 || 卢林强 &lt;br /&gt;
|-&lt;br /&gt;
| 231502014 || 杨子烨 &lt;br /&gt;
|-&lt;br /&gt;
| 231502015 || 胡子豪 &lt;br /&gt;
|-&lt;br /&gt;
| 231502016 || 綦浩量 &lt;br /&gt;
|-&lt;br /&gt;
| 231830135 || 周林辉 &lt;br /&gt;
|-&lt;br /&gt;
| 231870073 || 朱伟鹏 &lt;br /&gt;
|-&lt;br /&gt;
| 231870127 || 李熠城 &lt;br /&gt;
|-&lt;br /&gt;
| 231880394 || 翟笑晨 &lt;br /&gt;
|-&lt;br /&gt;
| 248355139 || 朴召怡 &lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
共 42 人&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=%E8%AE%A1%E7%AE%97%E6%96%B9%E6%B3%95_Numerical_method_(Spring_2025)&amp;diff=13164</id>
		<title>计算方法 Numerical method (Spring 2025)</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=%E8%AE%A1%E7%AE%97%E6%96%B9%E6%B3%95_Numerical_method_(Spring_2025)&amp;diff=13164"/>
		<updated>2025-05-21T07:21:11Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: /* Assignments */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox&lt;br /&gt;
|name         = Infobox&lt;br /&gt;
|bodystyle    = &lt;br /&gt;
|title        = &amp;lt;font size=3&amp;gt;计算方法&lt;br /&gt;
&amp;lt;br&amp;gt;Numerical method&amp;lt;/font&amp;gt;&lt;br /&gt;
|titlestyle   = &lt;br /&gt;
&lt;br /&gt;
|image        = &lt;br /&gt;
|imagestyle   = &lt;br /&gt;
|caption      = &lt;br /&gt;
|captionstyle = &lt;br /&gt;
|headerstyle  = background:#ccf;&lt;br /&gt;
|labelstyle   = background:#ddf;&lt;br /&gt;
|datastyle    = &lt;br /&gt;
&lt;br /&gt;
|header1 =Instructor&lt;br /&gt;
|label1  = &lt;br /&gt;
|data1   = &lt;br /&gt;
|header2 = &lt;br /&gt;
|label2  = &lt;br /&gt;
|data2   = 刘景铖&lt;br /&gt;
|header3 = &lt;br /&gt;
|label3  = Email&lt;br /&gt;
|data3   = liu [at] nju [dot] edu [dot] cn  &lt;br /&gt;
|header4 =&lt;br /&gt;
|label4= Office&lt;br /&gt;
|data4= 计算机系 516&lt;br /&gt;
|header5 = Class&lt;br /&gt;
|label5  = &lt;br /&gt;
|data5   = &lt;br /&gt;
|header6 =&lt;br /&gt;
|label6  = Class meetings&lt;br /&gt;
|data6   = 周三 14:00-16:00 &amp;lt;br&amp;gt; 仙 Ⅱ- 405&lt;br /&gt;
|header7 =&lt;br /&gt;
|label7  = Place&lt;br /&gt;
|data7   = &lt;br /&gt;
|header8 =&lt;br /&gt;
|label8  = &lt;br /&gt;
|data8   = &lt;br /&gt;
|header9 = Textbooks&lt;br /&gt;
|label9  = &lt;br /&gt;
|data9   = &lt;br /&gt;
|header10 =&lt;br /&gt;
|label10  = &lt;br /&gt;
|data10   = &lt;br /&gt;
|header11 =&lt;br /&gt;
|label11  = &lt;br /&gt;
|data11   =  Timothy Sauer &amp;lt;br&amp;gt;数值分析 （Numerical Analysis）（原书第2版）.&amp;lt;br&amp;gt; 机械工业出版社.&lt;br /&gt;
|header12 = Teaching Assistants&lt;br /&gt;
|data13= 侯哲，于逸潇&lt;br /&gt;
|label14= Email&lt;br /&gt;
|data14=  {houzhe, yixiaoyu} [at] smail [dot] nju [dot] edu [dot] cn&lt;br /&gt;
|label15= Office&lt;br /&gt;
|data15=计算机系 410&lt;br /&gt;
|belowstyle = background:#ddf;&lt;br /&gt;
|below = &lt;br /&gt;
}}&lt;br /&gt;
=Announcement=&lt;br /&gt;
*Welcome&lt;br /&gt;
=Course info=&lt;br /&gt;
*&#039;&#039;&#039;Instructor&#039;&#039;&#039;: 刘景铖 ( liu [at] nju [dot] edu [dot] cn )&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Teaching assistants&#039;&#039;&#039;: 侯哲，于逸潇&lt;br /&gt;
*&#039;&#039;&#039;TA email&#039;&#039;&#039;: {houzhe, yixiaoyu} [at] smail [dot] nju [dot] edu [dot] cn&lt;br /&gt;
*&#039;&#039;&#039;Homework email&#039;&#039;&#039;: nm_nju_2025@163.com&lt;br /&gt;
*&#039;&#039;&#039;Class meeting&#039;&#039;&#039;:周三 14:00-16:00， 仙 Ⅱ- 405&lt;br /&gt;
*&#039;&#039;&#039;Office hour&#039;&#039;&#039;: 周二 16:00-18:00?, 计算机系516 (subject to change)&lt;br /&gt;
*&#039;&#039;&#039;QQ群&#039;&#039;&#039;: 1019649082.(加入时需报姓名、专业、学号)&lt;br /&gt;
&lt;br /&gt;
=Textbooks and Readings=&lt;br /&gt;
*数值分析 （Numerical Analysis）（原书第2版）. Timothy Sauer.   机械工业出版社.&lt;br /&gt;
*[https://people.csail.mit.edu/jsolomon/share/book/numerical_book.pdf Numerical Algorithms: Methods for Computer Vision, Machine Learning, and Graphics.  Justin Solomon. CRC Press]&lt;br /&gt;
*[https://www.cs.yale.edu/homes/vishnoi/Lxb-Web.pdf Lx=b, Laplacian Solver and Their Algorithmic Applications.  Nisheeth K. Vishnoi.]&lt;br /&gt;
如果在获取教材方面有困难可以联系助教。(仅限英文版)&lt;br /&gt;
&lt;br /&gt;
= Collaboration on Homework =&lt;br /&gt;
You are welcome to work on homework problems in study groups of no more than 3 people; however, you must always write up the solutions on your own, listing all collaborators at the top. Similarly, you may use books or online resources to help solve homework problems, but you must always credit all such sources in your writeup and you must never copy material verbatim.&lt;br /&gt;
&lt;br /&gt;
We believe that most students can distinguish between helping other students and cheating. You may discuss approaches but your solution must be written by you and you only. You should acknowledge everyone whom you have worked with or who has given you any significant ideas about the homework.&lt;br /&gt;
&lt;br /&gt;
Further, it is your responsibility to ensure that your solutions will not be visible to other students. If you use Github or another source control system to store your solutions electronically, you must ensure your account is configured so your solutions are not publicly visible. Many popular version control systems provide free repositories to students.&lt;br /&gt;
&lt;br /&gt;
As a final note, we’d like to point out that collaboration on homework, while permitted, can be detrimental to your learning if misused. In particular, avoid collaborations where you do not contribute enough to your own satisfaction. Such a collaboration not only cheats you out of an opportunity to learn through homework, but can also affect your confidence. If you feel that you are not contributing enough to your group, then try to spend time thinking about the problems alone before working with your group. If you end up solving the problem all by yourself, that’s great! And if not, you’ll still be better prepared to contribute to your group.&lt;br /&gt;
&lt;br /&gt;
See also [http://www.acm.org/publications/policies/plagiarism_policy ACM Policy on Plagiarism].&lt;br /&gt;
&lt;br /&gt;
=Assignments=&lt;br /&gt;
Late policy: In general, we will accomodate late submission requests ONLY IF you made such requests ahead of time.&lt;br /&gt;
# [[Media:Computational Method 2025 Assignments 1.pdf| Homework1]] 请在2025年03月04日23点59分之前提交到 nm_nju_2025@163.com  (文件名为&#039;学号_姓名_A1.pdf&#039;) [[计算方法 Numerical method (Spring 2025)/Homework1 提交名单|Homework1 提交名单]]&lt;br /&gt;
# [[Media:Computational Method 2025 Assignments 2.pdf| Homework2]] 请在2025年03月18日23点59分之前提交到 nm_nju_2025@163.com  (文件名为&#039;学号_姓名_A2.pdf&#039;) [[计算方法 Numerical method (Spring 2025)/Homework2 提交名单|Homework2 提交名单]]&lt;br /&gt;
# [[Media:Computational Method 2025 Assignments 3.pdf| Homework3]] 请在2025年04月01日23点59分之前提交到 nm_nju_2025@163.com  (文件名为&#039;学号_姓名_A3.pdf&#039;) [[计算方法 Numerical method (Spring 2025)/Homework3 提交名单|Homework3 提交名单]]&lt;br /&gt;
# [[Media:Computational Method 2025 Assignments 4.pdf| Homework4]] 请在2025年04月22日23点59分之前提交到 nm_nju_2025@163.com  (文件名为&#039;学号_姓名_A4.pdf&#039;) [[计算方法 Numerical method (Spring 2025)/Homework4 提交名单|Homework4 提交名单]]&lt;br /&gt;
# [[Media:Computational Method 2025 Assignments 5.pdf| Homework5]] 请在2025年05月06日23点59分之前提交到 nm_nju_2025@163.com  (文件名为&#039;学号_姓名_A5.pdf&#039;) [[计算方法Numerical method (Spring 2025)/Homework5_提交名单|Homework5 提交名单]]&lt;br /&gt;
# [[Media:Computational Method 2025 Assignments 6 v3.pdf| Homework6]] 请在2025年05月20日23点59分之前提交到 nm_nju_2025@163.com  (文件名为&#039;学号_姓名_A6.pdf&#039;) [[计算方法Numerical method (Spring 2025)/Homework6_提交名单|Homework6 提交名单]]&lt;br /&gt;
# [[Media:Computational Method 2025 Assignments 7.pdf| Homework7]] 请在2025年06月03日23点59分之前提交到 nm_nju_2025@163.com  (文件名为&#039;学号_姓名_A7.pdf&#039;)&lt;br /&gt;
&lt;br /&gt;
=Lecture Notes=&lt;br /&gt;
如果有下载课件的问题请及时联系助教。&lt;br /&gt;
&lt;br /&gt;
# [[Media:计算方法1-2025.pdf|课程简介，函数求根]]&lt;br /&gt;
# [[Media:计算方法2-2025.pdf|牛顿法，插值，秘密分享，自纠错码]]&lt;br /&gt;
# [[Media:计算方法3-2025.pdf|Chebyshev插值与Chebyshev多项式，范数]]&lt;br /&gt;
# [[Media:计算方法4-2025.pdf|最小二乘法，Gram-Schmidt正交化与QR分解]]&lt;br /&gt;
# [[Media:计算方法5-2025.pdf|FFT，高斯消元与LU分解]]&lt;br /&gt;
# [[Media:计算方法6-2025.pdf|算子范数，条件数和迭代法]]&lt;br /&gt;
# [[Media:计算方法 7-特征值与幂迭代.pdf|特征值与幂迭代]]&lt;br /&gt;
# [[Media:计算方法 8-特征值的其它迭代方法与SVD.pdf|特征值的其它迭代方法与SVD]]&lt;br /&gt;
#* Further reading: [https://web.stanford.edu/class/cs168/l/l9.pdf lecture note by Tim Roughgarden and Greg Valiant on matrix completions]&lt;br /&gt;
# [[Media:计算方法9.pdf|迭代法解线性方程组：梯度下降方法与共轭梯度]]&lt;br /&gt;
# [[Media:计算方法10.pdf|幂迭代的特例：随机游走与马尔可夫链]]&lt;br /&gt;
# [[Media:计算方法11.pdf|谱图论]]&lt;br /&gt;
# [[Media:计算方法12.pdf|电阻电路网络，碰撞时间和遍历时间]]&lt;br /&gt;
# [[Media:计算方法13.pdf|线性规划入门]]&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=%E8%AE%A1%E7%AE%97%E6%96%B9%E6%B3%95_Numerical_method_(Spring_2025)&amp;diff=13092</id>
		<title>计算方法 Numerical method (Spring 2025)</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=%E8%AE%A1%E7%AE%97%E6%96%B9%E6%B3%95_Numerical_method_(Spring_2025)&amp;diff=13092"/>
		<updated>2025-04-23T02:19:46Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: /* Assignments */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox&lt;br /&gt;
|name         = Infobox&lt;br /&gt;
|bodystyle    = &lt;br /&gt;
|title        = &amp;lt;font size=3&amp;gt;计算方法&lt;br /&gt;
&amp;lt;br&amp;gt;Numerical method&amp;lt;/font&amp;gt;&lt;br /&gt;
|titlestyle   = &lt;br /&gt;
&lt;br /&gt;
|image        = &lt;br /&gt;
|imagestyle   = &lt;br /&gt;
|caption      = &lt;br /&gt;
|captionstyle = &lt;br /&gt;
|headerstyle  = background:#ccf;&lt;br /&gt;
|labelstyle   = background:#ddf;&lt;br /&gt;
|datastyle    = &lt;br /&gt;
&lt;br /&gt;
|header1 =Instructor&lt;br /&gt;
|label1  = &lt;br /&gt;
|data1   = &lt;br /&gt;
|header2 = &lt;br /&gt;
|label2  = &lt;br /&gt;
|data2   = 刘景铖&lt;br /&gt;
|header3 = &lt;br /&gt;
|label3  = Email&lt;br /&gt;
|data3   = liu [at] nju [dot] edu [dot] cn  &lt;br /&gt;
|header4 =&lt;br /&gt;
|label4= Office&lt;br /&gt;
|data4= 计算机系 516&lt;br /&gt;
|header5 = Class&lt;br /&gt;
|label5  = &lt;br /&gt;
|data5   = &lt;br /&gt;
|header6 =&lt;br /&gt;
|label6  = Class meetings&lt;br /&gt;
|data6   = 周三 14:00-16:00 &amp;lt;br&amp;gt; 仙 Ⅱ- 405&lt;br /&gt;
|header7 =&lt;br /&gt;
|label7  = Place&lt;br /&gt;
|data7   = &lt;br /&gt;
|header8 =&lt;br /&gt;
|label8  = &lt;br /&gt;
|data8   = &lt;br /&gt;
|header9 = Textbooks&lt;br /&gt;
|label9  = &lt;br /&gt;
|data9   = &lt;br /&gt;
|header10 =&lt;br /&gt;
|label10  = &lt;br /&gt;
|data10   = &lt;br /&gt;
|header11 =&lt;br /&gt;
|label11  = &lt;br /&gt;
|data11   =  Timothy Sauer &amp;lt;br&amp;gt;数值分析 （Numerical Analysis）（原书第2版）.&amp;lt;br&amp;gt; 机械工业出版社.&lt;br /&gt;
|header12 = Teaching Assistants&lt;br /&gt;
|data13= 侯哲，于逸潇&lt;br /&gt;
|label14= Email&lt;br /&gt;
|data14=  {houzhe, yixiaoyu} [at] smail [dot] nju [dot] edu [dot] cn&lt;br /&gt;
|label15= Office&lt;br /&gt;
|data15=计算机系 410&lt;br /&gt;
|belowstyle = background:#ddf;&lt;br /&gt;
|below = &lt;br /&gt;
}}&lt;br /&gt;
=Announcement=&lt;br /&gt;
*Welcome&lt;br /&gt;
=Course info=&lt;br /&gt;
*&#039;&#039;&#039;Instructor&#039;&#039;&#039;: 刘景铖 ( liu [at] nju [dot] edu [dot] cn )&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Teaching assistants&#039;&#039;&#039;: 侯哲，于逸潇&lt;br /&gt;
*&#039;&#039;&#039;TA email&#039;&#039;&#039;: {houzhe, yixiaoyu} [at] smail [dot] nju [dot] edu [dot] cn&lt;br /&gt;
*&#039;&#039;&#039;Homework email&#039;&#039;&#039;: nm_nju_2025@163.com&lt;br /&gt;
*&#039;&#039;&#039;Class meeting&#039;&#039;&#039;:周三 14:00-16:00， 仙 Ⅱ- 405&lt;br /&gt;
*&#039;&#039;&#039;Office hour&#039;&#039;&#039;: 周二 16:00-18:00?, 计算机系516 (subject to change)&lt;br /&gt;
*&#039;&#039;&#039;QQ群&#039;&#039;&#039;: 1019649082.(加入时需报姓名、专业、学号)&lt;br /&gt;
&lt;br /&gt;
=Textbooks and Readings=&lt;br /&gt;
*数值分析 （Numerical Analysis）（原书第2版）. Timothy Sauer.   机械工业出版社.&lt;br /&gt;
*[https://people.csail.mit.edu/jsolomon/share/book/numerical_book.pdf Numerical Algorithms: Methods for Computer Vision, Machine Learning, and Graphics.  Justin Solomon. CRC Press]&lt;br /&gt;
*[https://www.cs.yale.edu/homes/vishnoi/Lxb-Web.pdf Lx=b, Laplacian Solver and Their Algorithmic Applications.  Nisheeth K. Vishnoi.]&lt;br /&gt;
如果在获取教材方面有困难可以联系助教。(仅限英文版)&lt;br /&gt;
&lt;br /&gt;
= Collaboration on Homework =&lt;br /&gt;
You are welcome to work on homework problems in study groups of no more than 3 people; however, you must always write up the solutions on your own, listing all collaborators at the top. Similarly, you may use books or online resources to help solve homework problems, but you must always credit all such sources in your writeup and you must never copy material verbatim.&lt;br /&gt;
&lt;br /&gt;
We believe that most students can distinguish between helping other students and cheating. You may discuss approaches but your solution must be written by you and you only. You should acknowledge everyone whom you have worked with or who has given you any significant ideas about the homework.&lt;br /&gt;
&lt;br /&gt;
Further, it is your responsibility to ensure that your solutions will not be visible to other students. If you use Github or another source control system to store your solutions electronically, you must ensure your account is configured so your solutions are not publicly visible. Many popular version control systems provide free repositories to students.&lt;br /&gt;
&lt;br /&gt;
As a final note, we’d like to point out that collaboration on homework, while permitted, can be detrimental to your learning if misused. In particular, avoid collaborations where you do not contribute enough to your own satisfaction. Such a collaboration not only cheats you out of an opportunity to learn through homework, but can also affect your confidence. If you feel that you are not contributing enough to your group, then try to spend time thinking about the problems alone before working with your group. If you end up solving the problem all by yourself, that’s great! And if not, you’ll still be better prepared to contribute to your group.&lt;br /&gt;
&lt;br /&gt;
See also [http://www.acm.org/publications/policies/plagiarism_policy ACM Policy on Plagiarism].&lt;br /&gt;
&lt;br /&gt;
=Assignments=&lt;br /&gt;
Late policy: In general, we will accomodate late submission requests ONLY IF you made such requests ahead of time.&lt;br /&gt;
# [[Media:Computational Method 2025 Assignments 1.pdf| Homework1]] 请在2025年03月04日23点59分之前提交到 nm_nju_2025@163.com  (文件名为&#039;学号_姓名_A1.pdf&#039;) [[计算方法 Numerical method (Spring 2025)/Homework1 提交名单|Homework1 提交名单]]&lt;br /&gt;
# [[Media:Computational Method 2025 Assignments 2.pdf| Homework2]] 请在2025年03月18日23点59分之前提交到 nm_nju_2025@163.com  (文件名为&#039;学号_姓名_A2.pdf&#039;) [[计算方法 Numerical method (Spring 2025)/Homework2 提交名单|Homework2 提交名单]]&lt;br /&gt;
# [[Media:Computational Method 2025 Assignments 3.pdf| Homework3]] 请在2025年04月01日23点59分之前提交到 nm_nju_2025@163.com  (文件名为&#039;学号_姓名_A3.pdf&#039;) [[计算方法 Numerical method (Spring 2025)/Homework3 提交名单|Homework3 提交名单]]&lt;br /&gt;
# [[Media:Computational Method 2025 Assignments 4.pdf| Homework4]] 请在2025年04月22日23点59分之前提交到 nm_nju_2025@163.com  (文件名为&#039;学号_姓名_A4.pdf&#039;) [[计算方法 Numerical method (Spring 2025)/Homework4 提交名单|Homework4 提交名单]]&lt;br /&gt;
# [[Media:Computational Method 2025 Assignments 5.pdf| Homework5]] 请在2025年05月06日23点59分之前提交到 nm_nju_2025@163.com  (文件名为&#039;学号_姓名_A5.pdf&#039;)&lt;br /&gt;
&lt;br /&gt;
=Lecture Notes=&lt;br /&gt;
如果有下载课件的问题请及时联系助教。&lt;br /&gt;
&lt;br /&gt;
# [[Media:计算方法1-2025.pdf|课程简介，函数求根]]&lt;br /&gt;
# [[Media:计算方法2-2025.pdf|牛顿法，插值，秘密分享，自纠错码]]&lt;br /&gt;
# [[Media:计算方法3-2025.pdf|Chebyshev插值与Chebyshev多项式，范数]]&lt;br /&gt;
# [[Media:计算方法4-2025.pdf|最小二乘法，Gram-Schmidt正交化与QR分解]]&lt;br /&gt;
# [[Media:计算方法5-2025.pdf|FFT，高斯消元与LU分解]]&lt;br /&gt;
# [[Media:计算方法6-2025.pdf|算子范数，条件数和迭代法]]&lt;br /&gt;
# [[Media:计算方法 7-特征值与幂迭代.pdf|特征值与幂迭代]]&lt;br /&gt;
# [[Media:计算方法 8-特征值的其它迭代方法与SVD.pdf|特征值的其它迭代方法与SVD]]&lt;br /&gt;
#* Further reading: [https://web.stanford.edu/class/cs168/l/l9.pdf lecture note by Tim Roughgarden and Greg Valiant on matrix completions]&lt;br /&gt;
# [[Media:计算方法9.pdf|迭代法解线性方程组：梯度下降方法与共轭梯度]]&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=File:Computational_Method_2025_Assignments_5.pdf&amp;diff=13091</id>
		<title>File:Computational Method 2025 Assignments 5.pdf</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=File:Computational_Method_2025_Assignments_5.pdf&amp;diff=13091"/>
		<updated>2025-04-23T02:18:51Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=%E8%AE%A1%E7%AE%97%E6%96%B9%E6%B3%95_Numerical_method_(Spring_2025)/Homework4_%E6%8F%90%E4%BA%A4%E5%90%8D%E5%8D%95&amp;diff=13090</id>
		<title>计算方法 Numerical method (Spring 2025)/Homework4 提交名单</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=%E8%AE%A1%E7%AE%97%E6%96%B9%E6%B3%95_Numerical_method_(Spring_2025)/Homework4_%E6%8F%90%E4%BA%A4%E5%90%8D%E5%8D%95&amp;diff=13090"/>
		<updated>2025-04-23T02:02:48Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: Created page with &amp;quot; 如有错漏请邮件联系助教. &amp;lt;center&amp;gt; {| class=&amp;quot;wikitable&amp;quot; |- ! 学号 !! 姓名 |- | 221220090 || 周思桥  |- | 221240040 || 郑雯琪  |- | 231098068 || 戎昱  |- | 231098091 || 刘棣文  |- | 231098166 || 陈展  |- | 231200035 || 葛翰飞  |- | 231220006 || 陆华均  |- | 231220036 || 周楚函  |- | 231220065 || 劳汉显  |- | 231220067 || 黄裕书琪  |- | 231220071 || 吴江涛  |- | 231220122 || 安琦煜  |- | 231220166 || 苏易  |- | 231220171 |...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; 如有错漏请邮件联系助教.&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 学号 !! 姓名&lt;br /&gt;
|-&lt;br /&gt;
| 221220090 || 周思桥 &lt;br /&gt;
|-&lt;br /&gt;
| 221240040 || 郑雯琪 &lt;br /&gt;
|-&lt;br /&gt;
| 231098068 || 戎昱 &lt;br /&gt;
|-&lt;br /&gt;
| 231098091 || 刘棣文 &lt;br /&gt;
|-&lt;br /&gt;
| 231098166 || 陈展 &lt;br /&gt;
|-&lt;br /&gt;
| 231200035 || 葛翰飞 &lt;br /&gt;
|-&lt;br /&gt;
| 231220006 || 陆华均 &lt;br /&gt;
|-&lt;br /&gt;
| 231220036 || 周楚函 &lt;br /&gt;
|-&lt;br /&gt;
| 231220065 || 劳汉显 &lt;br /&gt;
|-&lt;br /&gt;
| 231220067 || 黄裕书琪 &lt;br /&gt;
|-&lt;br /&gt;
| 231220071 || 吴江涛 &lt;br /&gt;
|-&lt;br /&gt;
| 231220122 || 安琦煜 &lt;br /&gt;
|-&lt;br /&gt;
| 231220166 || 苏易 &lt;br /&gt;
|-&lt;br /&gt;
| 231220171 || 刘正阳 &lt;br /&gt;
|-&lt;br /&gt;
| 231220176 || 罗皓然 &lt;br /&gt;
|-&lt;br /&gt;
| 231220179 || 徐钰炜 &lt;br /&gt;
|-&lt;br /&gt;
| 231230102 || 庄铸锴 &lt;br /&gt;
|-&lt;br /&gt;
| 231240002 || 余孟凡 &lt;br /&gt;
|-&lt;br /&gt;
| 231240004 || 何梓杨 &lt;br /&gt;
|-&lt;br /&gt;
| 231240009 || 陈心怡 &lt;br /&gt;
|-&lt;br /&gt;
| 231240011 || 陈力琰 &lt;br /&gt;
|-&lt;br /&gt;
| 231240013 || 南晨曦 &lt;br /&gt;
|-&lt;br /&gt;
| 231240016 || 徐冰冰 &lt;br /&gt;
|-&lt;br /&gt;
| 231240018 || 渠翔凯 &lt;br /&gt;
|-&lt;br /&gt;
| 231240027 || 彭浩楠 &lt;br /&gt;
|-&lt;br /&gt;
| 231240029 || 朱非凡 &lt;br /&gt;
|-&lt;br /&gt;
| 231240031 || 吴天祥 &lt;br /&gt;
|-&lt;br /&gt;
| 231240038 || 肖金宇 &lt;br /&gt;
|-&lt;br /&gt;
| 231240045 || 杨俊炜 &lt;br /&gt;
|-&lt;br /&gt;
| 231240047 || 姜淮仁 &lt;br /&gt;
|-&lt;br /&gt;
| 231240051 || 王昱霏 &lt;br /&gt;
|-&lt;br /&gt;
| 231240053 || 王艺文 &lt;br /&gt;
|-&lt;br /&gt;
| 231240056 || 靳濡搏 &lt;br /&gt;
|-&lt;br /&gt;
| 231502012 || 许立恒 &lt;br /&gt;
|-&lt;br /&gt;
| 231502013 || 卢林强 &lt;br /&gt;
|-&lt;br /&gt;
| 231502014 || 杨子烨 &lt;br /&gt;
|-&lt;br /&gt;
| 231502015 || 胡子豪 &lt;br /&gt;
|-&lt;br /&gt;
| 231502016 || 綦浩量 &lt;br /&gt;
|-&lt;br /&gt;
| 231830135 || 周林辉 &lt;br /&gt;
|-&lt;br /&gt;
| 231840160 || 温昊臻 &lt;br /&gt;
|-&lt;br /&gt;
| 231870073 || 朱伟鹏 &lt;br /&gt;
|-&lt;br /&gt;
| 231870127 || 李熠城 &lt;br /&gt;
|-&lt;br /&gt;
| 231880394 || 翟笑晨 &lt;br /&gt;
|-&lt;br /&gt;
| 248355139 || 朴召怡 &lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
共 44 人&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=%E8%AE%A1%E7%AE%97%E6%96%B9%E6%B3%95_Numerical_method_(Spring_2025)&amp;diff=13089</id>
		<title>计算方法 Numerical method (Spring 2025)</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=%E8%AE%A1%E7%AE%97%E6%96%B9%E6%B3%95_Numerical_method_(Spring_2025)&amp;diff=13089"/>
		<updated>2025-04-23T02:02:32Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: /* Assignments */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox&lt;br /&gt;
|name         = Infobox&lt;br /&gt;
|bodystyle    = &lt;br /&gt;
|title        = &amp;lt;font size=3&amp;gt;计算方法&lt;br /&gt;
&amp;lt;br&amp;gt;Numerical method&amp;lt;/font&amp;gt;&lt;br /&gt;
|titlestyle   = &lt;br /&gt;
&lt;br /&gt;
|image        = &lt;br /&gt;
|imagestyle   = &lt;br /&gt;
|caption      = &lt;br /&gt;
|captionstyle = &lt;br /&gt;
|headerstyle  = background:#ccf;&lt;br /&gt;
|labelstyle   = background:#ddf;&lt;br /&gt;
|datastyle    = &lt;br /&gt;
&lt;br /&gt;
|header1 =Instructor&lt;br /&gt;
|label1  = &lt;br /&gt;
|data1   = &lt;br /&gt;
|header2 = &lt;br /&gt;
|label2  = &lt;br /&gt;
|data2   = 刘景铖&lt;br /&gt;
|header3 = &lt;br /&gt;
|label3  = Email&lt;br /&gt;
|data3   = liu [at] nju [dot] edu [dot] cn  &lt;br /&gt;
|header4 =&lt;br /&gt;
|label4= Office&lt;br /&gt;
|data4= 计算机系 516&lt;br /&gt;
|header5 = Class&lt;br /&gt;
|label5  = &lt;br /&gt;
|data5   = &lt;br /&gt;
|header6 =&lt;br /&gt;
|label6  = Class meetings&lt;br /&gt;
|data6   = 周三 14:00-16:00 &amp;lt;br&amp;gt; 仙 Ⅱ- 405&lt;br /&gt;
|header7 =&lt;br /&gt;
|label7  = Place&lt;br /&gt;
|data7   = &lt;br /&gt;
|header8 =&lt;br /&gt;
|label8  = &lt;br /&gt;
|data8   = &lt;br /&gt;
|header9 = Textbooks&lt;br /&gt;
|label9  = &lt;br /&gt;
|data9   = &lt;br /&gt;
|header10 =&lt;br /&gt;
|label10  = &lt;br /&gt;
|data10   = &lt;br /&gt;
|header11 =&lt;br /&gt;
|label11  = &lt;br /&gt;
|data11   =  Timothy Sauer &amp;lt;br&amp;gt;数值分析 （Numerical Analysis）（原书第2版）.&amp;lt;br&amp;gt; 机械工业出版社.&lt;br /&gt;
|header12 = Teaching Assistants&lt;br /&gt;
|data13= 侯哲，于逸潇&lt;br /&gt;
|label14= Email&lt;br /&gt;
|data14=  {houzhe, yixiaoyu} [at] smail [dot] nju [dot] edu [dot] cn&lt;br /&gt;
|label15= Office&lt;br /&gt;
|data15=计算机系 410&lt;br /&gt;
|belowstyle = background:#ddf;&lt;br /&gt;
|below = &lt;br /&gt;
}}&lt;br /&gt;
=Announcement=&lt;br /&gt;
*Welcome&lt;br /&gt;
=Course info=&lt;br /&gt;
*&#039;&#039;&#039;Instructor&#039;&#039;&#039;: 刘景铖 ( liu [at] nju [dot] edu [dot] cn )&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Teaching assistants&#039;&#039;&#039;: 侯哲，于逸潇&lt;br /&gt;
*&#039;&#039;&#039;TA email&#039;&#039;&#039;: {houzhe, yixiaoyu} [at] smail [dot] nju [dot] edu [dot] cn&lt;br /&gt;
*&#039;&#039;&#039;Homework email&#039;&#039;&#039;: nm_nju_2025@163.com&lt;br /&gt;
*&#039;&#039;&#039;Class meeting&#039;&#039;&#039;:周三 14:00-16:00， 仙 Ⅱ- 405&lt;br /&gt;
*&#039;&#039;&#039;Office hour&#039;&#039;&#039;: 周二 16:00-18:00?, 计算机系516 (subject to change)&lt;br /&gt;
*&#039;&#039;&#039;QQ群&#039;&#039;&#039;: 1019649082.(加入时需报姓名、专业、学号)&lt;br /&gt;
&lt;br /&gt;
=Textbooks and Readings=&lt;br /&gt;
*数值分析 （Numerical Analysis）（原书第2版）. Timothy Sauer.   机械工业出版社.&lt;br /&gt;
*[https://people.csail.mit.edu/jsolomon/share/book/numerical_book.pdf Numerical Algorithms: Methods for Computer Vision, Machine Learning, and Graphics.  Justin Solomon. CRC Press]&lt;br /&gt;
*[https://www.cs.yale.edu/homes/vishnoi/Lxb-Web.pdf Lx=b, Laplacian Solver and Their Algorithmic Applications.  Nisheeth K. Vishnoi.]&lt;br /&gt;
如果在获取教材方面有困难可以联系助教。(仅限英文版)&lt;br /&gt;
&lt;br /&gt;
= Collaboration on Homework =&lt;br /&gt;
You are welcome to work on homework problems in study groups of no more than 3 people; however, you must always write up the solutions on your own, listing all collaborators at the top. Similarly, you may use books or online resources to help solve homework problems, but you must always credit all such sources in your writeup and you must never copy material verbatim.&lt;br /&gt;
&lt;br /&gt;
We believe that most students can distinguish between helping other students and cheating. You may discuss approaches but your solution must be written by you and you only. You should acknowledge everyone whom you have worked with or who has given you any significant ideas about the homework.&lt;br /&gt;
&lt;br /&gt;
Further, it is your responsibility to ensure that your solutions will not be visible to other students. If you use Github or another source control system to store your solutions electronically, you must ensure your account is configured so your solutions are not publicly visible. Many popular version control systems provide free repositories to students.&lt;br /&gt;
&lt;br /&gt;
As a final note, we’d like to point out that collaboration on homework, while permitted, can be detrimental to your learning if misused. In particular, avoid collaborations where you do not contribute enough to your own satisfaction. Such a collaboration not only cheats you out of an opportunity to learn through homework, but can also affect your confidence. If you feel that you are not contributing enough to your group, then try to spend time thinking about the problems alone before working with your group. If you end up solving the problem all by yourself, that’s great! And if not, you’ll still be better prepared to contribute to your group.&lt;br /&gt;
&lt;br /&gt;
See also [http://www.acm.org/publications/policies/plagiarism_policy ACM Policy on Plagiarism].&lt;br /&gt;
&lt;br /&gt;
=Assignments=&lt;br /&gt;
Late policy: In general, we will accomodate late submission requests ONLY IF you made such requests ahead of time.&lt;br /&gt;
# [[Media:Computational Method 2025 Assignments 1.pdf| Homework1]] 请在2025年03月04日23点59分之前提交到 nm_nju_2025@163.com  (文件名为&#039;学号_姓名_A1.pdf&#039;) [[计算方法 Numerical method (Spring 2025)/Homework1 提交名单|Homework1 提交名单]]&lt;br /&gt;
# [[Media:Computational Method 2025 Assignments 2.pdf| Homework2]] 请在2025年03月18日23点59分之前提交到 nm_nju_2025@163.com  (文件名为&#039;学号_姓名_A2.pdf&#039;) [[计算方法 Numerical method (Spring 2025)/Homework2 提交名单|Homework2 提交名单]]&lt;br /&gt;
# [[Media:Computational Method 2025 Assignments 3.pdf| Homework3]] 请在2025年04月01日23点59分之前提交到 nm_nju_2025@163.com  (文件名为&#039;学号_姓名_A3.pdf&#039;) [[计算方法 Numerical method (Spring 2025)/Homework3 提交名单|Homework3 提交名单]]&lt;br /&gt;
# [[Media:Computational Method 2025 Assignments 4.pdf| Homework4]] 请在2025年04月22日23点59分之前提交到 nm_nju_2025@163.com  (文件名为&#039;学号_姓名_A4.pdf&#039;) [[计算方法 Numerical method (Spring 2025)/Homework4 提交名单|Homework4 提交名单]]&lt;br /&gt;
&lt;br /&gt;
=Lecture Notes=&lt;br /&gt;
如果有下载课件的问题请及时联系助教。&lt;br /&gt;
&lt;br /&gt;
# [[Media:计算方法1-2025.pdf|课程简介，函数求根]]&lt;br /&gt;
# [[Media:计算方法2-2025.pdf|牛顿法，插值，秘密分享，自纠错码]]&lt;br /&gt;
# [[Media:计算方法3-2025.pdf|Chebyshev插值与Chebyshev多项式，范数]]&lt;br /&gt;
# [[Media:计算方法4-2025.pdf|最小二乘法，Gram-Schmidt正交化与QR分解]]&lt;br /&gt;
# [[Media:计算方法5-2025.pdf|FFT，高斯消元与LU分解]]&lt;br /&gt;
# [[Media:计算方法6-2025.pdf|算子范数，条件数和迭代法]]&lt;br /&gt;
# [[Media:计算方法 7-特征值与幂迭代.pdf|特征值与幂迭代]]&lt;br /&gt;
# [[Media:计算方法 8-特征值的其它迭代方法与SVD.pdf|特征值的其它迭代方法与SVD]]&lt;br /&gt;
#* Further reading: [https://web.stanford.edu/class/cs168/l/l9.pdf lecture note by Tim Roughgarden and Greg Valiant on matrix completions]&lt;br /&gt;
# [[Media:计算方法9.pdf|迭代法解线性方程组：梯度下降方法与共轭梯度]]&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=%E8%AE%A1%E7%AE%97%E6%96%B9%E6%B3%95_Numerical_method_(Spring_2025)&amp;diff=13025</id>
		<title>计算方法 Numerical method (Spring 2025)</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=%E8%AE%A1%E7%AE%97%E6%96%B9%E6%B3%95_Numerical_method_(Spring_2025)&amp;diff=13025"/>
		<updated>2025-04-02T02:41:21Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: /* Assignments */  upload assignment 4&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox&lt;br /&gt;
|name         = Infobox&lt;br /&gt;
|bodystyle    = &lt;br /&gt;
|title        = &amp;lt;font size=3&amp;gt;计算方法&lt;br /&gt;
&amp;lt;br&amp;gt;Numerical method&amp;lt;/font&amp;gt;&lt;br /&gt;
|titlestyle   = &lt;br /&gt;
&lt;br /&gt;
|image        = &lt;br /&gt;
|imagestyle   = &lt;br /&gt;
|caption      = &lt;br /&gt;
|captionstyle = &lt;br /&gt;
|headerstyle  = background:#ccf;&lt;br /&gt;
|labelstyle   = background:#ddf;&lt;br /&gt;
|datastyle    = &lt;br /&gt;
&lt;br /&gt;
|header1 =Instructor&lt;br /&gt;
|label1  = &lt;br /&gt;
|data1   = &lt;br /&gt;
|header2 = &lt;br /&gt;
|label2  = &lt;br /&gt;
|data2   = 刘景铖&lt;br /&gt;
|header3 = &lt;br /&gt;
|label3  = Email&lt;br /&gt;
|data3   = liu [at] nju [dot] edu [dot] cn  &lt;br /&gt;
|header4 =&lt;br /&gt;
|label4= Office&lt;br /&gt;
|data4= 计算机系 516&lt;br /&gt;
|header5 = Class&lt;br /&gt;
|label5  = &lt;br /&gt;
|data5   = &lt;br /&gt;
|header6 =&lt;br /&gt;
|label6  = Class meetings&lt;br /&gt;
|data6   = 周三 14:00-16:00 &amp;lt;br&amp;gt; 仙 Ⅱ- 405&lt;br /&gt;
|header7 =&lt;br /&gt;
|label7  = Place&lt;br /&gt;
|data7   = &lt;br /&gt;
|header8 =&lt;br /&gt;
|label8  = &lt;br /&gt;
|data8   = &lt;br /&gt;
|header9 = Textbooks&lt;br /&gt;
|label9  = &lt;br /&gt;
|data9   = &lt;br /&gt;
|header10 =&lt;br /&gt;
|label10  = &lt;br /&gt;
|data10   = &lt;br /&gt;
|header11 =&lt;br /&gt;
|label11  = &lt;br /&gt;
|data11   =  Timothy Sauer &amp;lt;br&amp;gt;数值分析 （Numerical Analysis）（原书第2版）.&amp;lt;br&amp;gt; 机械工业出版社.&lt;br /&gt;
|header12 = Teaching Assistants&lt;br /&gt;
|data13= 侯哲，于逸潇&lt;br /&gt;
|label14= Email&lt;br /&gt;
|data14=  {houzhe, yixiaoyu} [at] smail [dot] nju [dot] edu [dot] cn&lt;br /&gt;
|label15= Office&lt;br /&gt;
|data15=计算机系 410&lt;br /&gt;
|belowstyle = background:#ddf;&lt;br /&gt;
|below = &lt;br /&gt;
}}&lt;br /&gt;
=Announcement=&lt;br /&gt;
*Welcome&lt;br /&gt;
=Course info=&lt;br /&gt;
*&#039;&#039;&#039;Instructor&#039;&#039;&#039;: 刘景铖 ( liu [at] nju [dot] edu [dot] cn )&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Teaching assistants&#039;&#039;&#039;: 侯哲，于逸潇&lt;br /&gt;
*&#039;&#039;&#039;TA email&#039;&#039;&#039;: {houzhe, yixiaoyu} [at] smail [dot] nju [dot] edu [dot] cn&lt;br /&gt;
*&#039;&#039;&#039;Homework email&#039;&#039;&#039;: nm_nju_2025@163.com&lt;br /&gt;
*&#039;&#039;&#039;Class meeting&#039;&#039;&#039;:周三 14:00-16:00， 仙 Ⅱ- 405&lt;br /&gt;
*&#039;&#039;&#039;Office hour&#039;&#039;&#039;: 周二 16:00-18:00?, 计算机系516 (subject to change)&lt;br /&gt;
*&#039;&#039;&#039;QQ群&#039;&#039;&#039;: 1019649082.(加入时需报姓名、专业、学号)&lt;br /&gt;
&lt;br /&gt;
=Textbooks and Readings=&lt;br /&gt;
*数值分析 （Numerical Analysis）（原书第2版）. Timothy Sauer.   机械工业出版社.&lt;br /&gt;
*[https://people.csail.mit.edu/jsolomon/share/book/numerical_book.pdf Numerical Algorithms: Methods for Computer Vision, Machine Learning, and Graphics.  Justin Solomon. CRC Press]&lt;br /&gt;
*[https://www.cs.yale.edu/homes/vishnoi/Lxb-Web.pdf Lx=b, Laplacian Solver and Their Algorithmic Applications.  Nisheeth K. Vishnoi.]&lt;br /&gt;
如果在获取教材方面有困难可以联系助教。(仅限英文版)&lt;br /&gt;
&lt;br /&gt;
= Collaboration on Homework =&lt;br /&gt;
You are welcome to work on homework problems in study groups of no more than 3 people; however, you must always write up the solutions on your own, listing all collaborators at the top. Similarly, you may use books or online resources to help solve homework problems, but you must always credit all such sources in your writeup and you must never copy material verbatim.&lt;br /&gt;
&lt;br /&gt;
We believe that most students can distinguish between helping other students and cheating. You may discuss approaches but your solution must be written by you and you only. You should acknowledge everyone whom you have worked with or who has given you any significant ideas about the homework.&lt;br /&gt;
&lt;br /&gt;
Further, it is your responsibility to ensure that your solutions will not be visible to other students. If you use Github or another source control system to store your solutions electronically, you must ensure your account is configured so your solutions are not publicly visible. Many popular version control systems provide free repositories to students.&lt;br /&gt;
&lt;br /&gt;
As a final note, we’d like to point out that collaboration on homework, while permitted, can be detrimental to your learning if misused. In particular, avoid collaborations where you do not contribute enough to your own satisfaction. Such a collaboration not only cheats you out of an opportunity to learn through homework, but can also affect your confidence. If you feel that you are not contributing enough to your group, then try to spend time thinking about the problems alone before working with your group. If you end up solving the problem all by yourself, that’s great! And if not, you’ll still be better prepared to contribute to your group.&lt;br /&gt;
&lt;br /&gt;
See also [http://www.acm.org/publications/policies/plagiarism_policy ACM Policy on Plagiarism].&lt;br /&gt;
&lt;br /&gt;
=Assignments=&lt;br /&gt;
Late policy: In general, we will accomodate late submission requests ONLY IF you made such requests ahead of time.&lt;br /&gt;
# [[Media:Computational Method 2025 Assignments 1.pdf| Homework1]] 请在2025年03月04日23点59分之前提交到 nm_nju_2025@163.com  (文件名为&#039;学号_姓名_A1.pdf&#039;) [[计算方法 Numerical method (Spring 2025)/Homework1 提交名单|Homework1 提交名单]]&lt;br /&gt;
# [[Media:Computational Method 2025 Assignments 2.pdf| Homework2]] 请在2025年03月18日23点59分之前提交到 nm_nju_2025@163.com  (文件名为&#039;学号_姓名_A2.pdf&#039;) [[计算方法 Numerical method (Spring 2025)/Homework2 提交名单|Homework2 提交名单]]&lt;br /&gt;
# [[Media:Computational Method 2025 Assignments 3.pdf| Homework3]] 请在2025年04月01日23点59分之前提交到 nm_nju_2025@163.com  (文件名为&#039;学号_姓名_A3.pdf&#039;)&lt;br /&gt;
# [[Media:Computational Method 2025 Assignments 4.pdf| Homework4]] 请在2025年04月22日23点59分之前提交到 nm_nju_2025@163.com  (文件名为&#039;学号_姓名_A4.pdf&#039;)&lt;br /&gt;
&lt;br /&gt;
=Lecture Notes=&lt;br /&gt;
如果有下载课件的问题请及时联系助教。&lt;br /&gt;
&lt;br /&gt;
# [[Media:计算方法1-2025.pdf|课程简介，函数求根]]&lt;br /&gt;
# [[Media:计算方法2-2025.pdf|牛顿法，插值，秘密分享，自纠错码]]&lt;br /&gt;
# [[Media:计算方法3-2025.pdf|Chebyshev插值与Chebyshev多项式，范数]]&lt;br /&gt;
# [[Media:计算方法4-2025.pdf|最小二乘法，Gram-Schmidt正交化与QR分解]]&lt;br /&gt;
# [[Media:计算方法5-2025.pdf|FFT，高斯消元与LU分解]]&lt;br /&gt;
# [[Media:计算方法6-2025.pdf|算子范数，条件数和迭代法]]&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=File:Computational_Method_2025_Assignments_4.pdf&amp;diff=13024</id>
		<title>File:Computational Method 2025 Assignments 4.pdf</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=File:Computational_Method_2025_Assignments_4.pdf&amp;diff=13024"/>
		<updated>2025-04-02T02:40:27Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=%E8%AE%A1%E7%AE%97%E6%96%B9%E6%B3%95_Numerical_method_(Spring_2025)&amp;diff=13001</id>
		<title>计算方法 Numerical method (Spring 2025)</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=%E8%AE%A1%E7%AE%97%E6%96%B9%E6%B3%95_Numerical_method_(Spring_2025)&amp;diff=13001"/>
		<updated>2025-03-19T03:12:34Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: /* Assignments */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox&lt;br /&gt;
|name         = Infobox&lt;br /&gt;
|bodystyle    = &lt;br /&gt;
|title        = &amp;lt;font size=3&amp;gt;计算方法&lt;br /&gt;
&amp;lt;br&amp;gt;Numerical method&amp;lt;/font&amp;gt;&lt;br /&gt;
|titlestyle   = &lt;br /&gt;
&lt;br /&gt;
|image        = &lt;br /&gt;
|imagestyle   = &lt;br /&gt;
|caption      = &lt;br /&gt;
|captionstyle = &lt;br /&gt;
|headerstyle  = background:#ccf;&lt;br /&gt;
|labelstyle   = background:#ddf;&lt;br /&gt;
|datastyle    = &lt;br /&gt;
&lt;br /&gt;
|header1 =Instructor&lt;br /&gt;
|label1  = &lt;br /&gt;
|data1   = &lt;br /&gt;
|header2 = &lt;br /&gt;
|label2  = &lt;br /&gt;
|data2   = 刘景铖&lt;br /&gt;
|header3 = &lt;br /&gt;
|label3  = Email&lt;br /&gt;
|data3   = liu [at] nju [dot] edu [dot] cn  &lt;br /&gt;
|header4 =&lt;br /&gt;
|label4= Office&lt;br /&gt;
|data4= 计算机系 516&lt;br /&gt;
|header5 = Class&lt;br /&gt;
|label5  = &lt;br /&gt;
|data5   = &lt;br /&gt;
|header6 =&lt;br /&gt;
|label6  = Class meetings&lt;br /&gt;
|data6   = 周三 14:00-16:00 &amp;lt;br&amp;gt; 仙 Ⅱ- 405&lt;br /&gt;
|header7 =&lt;br /&gt;
|label7  = Place&lt;br /&gt;
|data7   = &lt;br /&gt;
|header8 =&lt;br /&gt;
|label8  = &lt;br /&gt;
|data8   = &lt;br /&gt;
|header9 = Textbooks&lt;br /&gt;
|label9  = &lt;br /&gt;
|data9   = &lt;br /&gt;
|header10 =&lt;br /&gt;
|label10  = &lt;br /&gt;
|data10   = &lt;br /&gt;
|header11 =&lt;br /&gt;
|label11  = &lt;br /&gt;
|data11   =  Timothy Sauer &amp;lt;br&amp;gt;数值分析 （Numerical Analysis）（原书第2版）.&amp;lt;br&amp;gt; 机械工业出版社.&lt;br /&gt;
|header12 = Teaching Assistants&lt;br /&gt;
|data13= 侯哲，于逸潇&lt;br /&gt;
|label14= Email&lt;br /&gt;
|data14=  {houzhe, yixiaoyu} [at] smail [dot] nju [dot] edu [dot] cn&lt;br /&gt;
|label15= Office&lt;br /&gt;
|data15=计算机系 410&lt;br /&gt;
|belowstyle = background:#ddf;&lt;br /&gt;
|below = &lt;br /&gt;
}}&lt;br /&gt;
=Announcement=&lt;br /&gt;
*Welcome&lt;br /&gt;
=Course info=&lt;br /&gt;
*&#039;&#039;&#039;Instructor&#039;&#039;&#039;: 刘景铖 ( liu [at] nju [dot] edu [dot] cn )&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Teaching assistants&#039;&#039;&#039;: 侯哲，于逸潇&lt;br /&gt;
*&#039;&#039;&#039;TA email&#039;&#039;&#039;: {houzhe, yixiaoyu} [at] smail [dot] nju [dot] edu [dot] cn&lt;br /&gt;
*&#039;&#039;&#039;Homework email&#039;&#039;&#039;: nm_nju_2025@163.com&lt;br /&gt;
*&#039;&#039;&#039;Class meeting&#039;&#039;&#039;:周三 14:00-16:00， 仙 Ⅱ- 405&lt;br /&gt;
*&#039;&#039;&#039;Office hour&#039;&#039;&#039;: 周二 16:00-18:00?, 计算机系516 (subject to change)&lt;br /&gt;
*&#039;&#039;&#039;QQ群&#039;&#039;&#039;: 1019649082.(加入时需报姓名、专业、学号)&lt;br /&gt;
&lt;br /&gt;
=Textbooks and Readings=&lt;br /&gt;
*数值分析 （Numerical Analysis）（原书第2版）. Timothy Sauer.   机械工业出版社.&lt;br /&gt;
*[https://people.csail.mit.edu/jsolomon/share/book/numerical_book.pdf Numerical Algorithms: Methods for Computer Vision, Machine Learning, and Graphics.  Justin Solomon. CRC Press]&lt;br /&gt;
*[https://www.cs.yale.edu/homes/vishnoi/Lxb-Web.pdf Lx=b, Laplacian Solver and Their Algorithmic Applications.  Nisheeth K. Vishnoi.]&lt;br /&gt;
如果在获取教材方面有困难可以联系助教。(仅限英文版)&lt;br /&gt;
&lt;br /&gt;
= Collaboration on Homework =&lt;br /&gt;
You are welcome to work on homework problems in study groups of no more than 3 people; however, you must always write up the solutions on your own, listing all collaborators at the top. Similarly, you may use books or online resources to help solve homework problems, but you must always credit all such sources in your writeup and you must never copy material verbatim.&lt;br /&gt;
&lt;br /&gt;
We believe that most students can distinguish between helping other students and cheating. You may discuss approaches but your solution must be written by you and you only. You should acknowledge everyone whom you have worked with or who has given you any significant ideas about the homework.&lt;br /&gt;
&lt;br /&gt;
Further, it is your responsibility to ensure that your solutions will not be visible to other students. If you use Github or another source control system to store your solutions electronically, you must ensure your account is configured so your solutions are not publicly visible. Many popular version control systems provide free repositories to students.&lt;br /&gt;
&lt;br /&gt;
As a final note, we’d like to point out that collaboration on homework, while permitted, can be detrimental to your learning if misused. In particular, avoid collaborations where you do not contribute enough to your own satisfaction. Such a collaboration not only cheats you out of an opportunity to learn through homework, but can also affect your confidence. If you feel that you are not contributing enough to your group, then try to spend time thinking about the problems alone before working with your group. If you end up solving the problem all by yourself, that’s great! And if not, you’ll still be better prepared to contribute to your group.&lt;br /&gt;
&lt;br /&gt;
See also [http://www.acm.org/publications/policies/plagiarism_policy ACM Policy on Plagiarism].&lt;br /&gt;
&lt;br /&gt;
=Assignments=&lt;br /&gt;
Late policy: In general, we will accomodate late submission requests ONLY IF you made such requests ahead of time.&lt;br /&gt;
# [[Media:Computational Method 2025 Assignments 1.pdf| Homework1]] 请在2025年03月04日23点59分之前提交到 nm_nju_2025@163.com  (文件名为&#039;学号_姓名_A1.pdf&#039;) [[计算方法 Numerical method (Spring 2025)/Homework1 提交名单|Homework1 提交名单]]&lt;br /&gt;
# [[Media:Computational Method 2025 Assignments 2.pdf| Homework2]] 请在2025年03月18日23点59分之前提交到 nm_nju_2025@163.com  (文件名为&#039;学号_姓名_A2.pdf&#039;) [[计算方法 Numerical method (Spring 2025)/Homework2 提交名单|Homework2 提交名单]]&lt;br /&gt;
&lt;br /&gt;
=Lecture Notes=&lt;br /&gt;
如果有下载课件的问题请及时联系助教。&lt;br /&gt;
&lt;br /&gt;
# [[Media:计算方法1-2025.pdf|课程简介，函数求根]]&lt;br /&gt;
# [[Media:计算方法2-2025.pdf|牛顿法，插值，秘密分享，自纠错码]]&lt;br /&gt;
# [[Media:计算方法3-2025.pdf|Chebyshev插值与Chebyshev多项式，范数]]&lt;br /&gt;
# [[Media:计算方法4-2025.pdf|最小二乘法，Gram-Schmidt正交化与QR分解]]&lt;br /&gt;
# [[Media:计算方法5-2025.pdf|FFT，高斯消元与LU分解]]&lt;br /&gt;
# [[Media:计算方法6-2025.pdf|算子范数，条件数和迭代法]]&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=%E8%AE%A1%E7%AE%97%E6%96%B9%E6%B3%95_Numerical_method_(Spring_2025)/Homework2_%E6%8F%90%E4%BA%A4%E5%90%8D%E5%8D%95&amp;diff=13000</id>
		<title>计算方法 Numerical method (Spring 2025)/Homework2 提交名单</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=%E8%AE%A1%E7%AE%97%E6%96%B9%E6%B3%95_Numerical_method_(Spring_2025)/Homework2_%E6%8F%90%E4%BA%A4%E5%90%8D%E5%8D%95&amp;diff=13000"/>
		<updated>2025-03-19T03:12:25Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: Created page with &amp;quot; 如有错漏请邮件联系助教. &amp;lt;center&amp;gt; {| class=&amp;quot;wikitable&amp;quot; |- ! 学号 !! 姓名 |- | 221220090 || 周思桥  |- | 221240002 || 季悦宁  |- | 221240040 || 郑雯琪  |- | 231098068 || 戎昱  |- | 231098091 || 刘棣文  |- | 231098166 || 陈展  |- | 231200035 || 葛翰飞  |- | 231220006 || 陆华均  |- | 231220036 || 周楚函  |- | 231220049 || 张泽宇  |- | 231220065 || 劳汉显  |- | 231220067 || 黄裕书琪  |- | 231220071 || 吴江涛  |- | 23122012...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; 如有错漏请邮件联系助教.&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 学号 !! 姓名&lt;br /&gt;
|-&lt;br /&gt;
| 221220090 || 周思桥 &lt;br /&gt;
|-&lt;br /&gt;
| 221240002 || 季悦宁 &lt;br /&gt;
|-&lt;br /&gt;
| 221240040 || 郑雯琪 &lt;br /&gt;
|-&lt;br /&gt;
| 231098068 || 戎昱 &lt;br /&gt;
|-&lt;br /&gt;
| 231098091 || 刘棣文 &lt;br /&gt;
|-&lt;br /&gt;
| 231098166 || 陈展 &lt;br /&gt;
|-&lt;br /&gt;
| 231200035 || 葛翰飞 &lt;br /&gt;
|-&lt;br /&gt;
| 231220006 || 陆华均 &lt;br /&gt;
|-&lt;br /&gt;
| 231220036 || 周楚函 &lt;br /&gt;
|-&lt;br /&gt;
| 231220049 || 张泽宇 &lt;br /&gt;
|-&lt;br /&gt;
| 231220065 || 劳汉显 &lt;br /&gt;
|-&lt;br /&gt;
| 231220067 || 黄裕书琪 &lt;br /&gt;
|-&lt;br /&gt;
| 231220071 || 吴江涛 &lt;br /&gt;
|-&lt;br /&gt;
| 231220122 || 安琦煜 &lt;br /&gt;
|-&lt;br /&gt;
| 231220132 || 陈志远 &lt;br /&gt;
|-&lt;br /&gt;
| 231220166 || 苏易 &lt;br /&gt;
|-&lt;br /&gt;
| 231220171 || 刘正阳 &lt;br /&gt;
|-&lt;br /&gt;
| 231220176 || 罗皓然 &lt;br /&gt;
|-&lt;br /&gt;
| 231220179 || 徐钰炜 &lt;br /&gt;
|-&lt;br /&gt;
| 231230102 || 庄铸锴 &lt;br /&gt;
|-&lt;br /&gt;
| 231240002 || 余孟凡 &lt;br /&gt;
|-&lt;br /&gt;
| 231240004 || 何梓杨 &lt;br /&gt;
|-&lt;br /&gt;
| 231240009 || 陈心怡 &lt;br /&gt;
|-&lt;br /&gt;
| 231240011 || 陈力琰 &lt;br /&gt;
|-&lt;br /&gt;
| 231240013 || 南晨曦 &lt;br /&gt;
|-&lt;br /&gt;
| 231240016 || 徐冰冰 &lt;br /&gt;
|-&lt;br /&gt;
| 231240018 || 渠翔凯 &lt;br /&gt;
|-&lt;br /&gt;
| 231240027 || 彭浩楠 &lt;br /&gt;
|-&lt;br /&gt;
| 231240029 || 朱非凡 &lt;br /&gt;
|-&lt;br /&gt;
| 231240031 || 吴天祥 &lt;br /&gt;
|-&lt;br /&gt;
| 231240038 || 肖金宇 &lt;br /&gt;
|-&lt;br /&gt;
| 231240045 || 杨俊炜 &lt;br /&gt;
|-&lt;br /&gt;
| 231240047 || 姜淮仁 &lt;br /&gt;
|-&lt;br /&gt;
| 231240051 || 王昱霏 &lt;br /&gt;
|-&lt;br /&gt;
| 231240053 || 王艺文 &lt;br /&gt;
|-&lt;br /&gt;
| 231240056 || 靳濡搏 &lt;br /&gt;
|-&lt;br /&gt;
| 231300082 || 王鹭天 &lt;br /&gt;
|-&lt;br /&gt;
| 231502012 || 许立恒 &lt;br /&gt;
|-&lt;br /&gt;
| 231502013 || 卢林强 &lt;br /&gt;
|-&lt;br /&gt;
| 231502014 || 杨子烨 &lt;br /&gt;
|-&lt;br /&gt;
| 231502015 || 胡子豪 &lt;br /&gt;
|-&lt;br /&gt;
| 231502016 || 綦浩量 &lt;br /&gt;
|-&lt;br /&gt;
| 231830135 || 周林辉 &lt;br /&gt;
|-&lt;br /&gt;
| 231840160 || 温昊臻 &lt;br /&gt;
|-&lt;br /&gt;
| 231870073 || 朱伟鹏 &lt;br /&gt;
|-&lt;br /&gt;
| 231870127 || 李熠城 &lt;br /&gt;
|-&lt;br /&gt;
| 231880140 || 桂天麟 &lt;br /&gt;
|-&lt;br /&gt;
| 231880394 || 翟笑晨 &lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
共 48 人&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=%E8%AE%A1%E7%AE%97%E6%96%B9%E6%B3%95_Numerical_method_(Spring_2025)&amp;diff=12924</id>
		<title>计算方法 Numerical method (Spring 2025)</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=%E8%AE%A1%E7%AE%97%E6%96%B9%E6%B3%95_Numerical_method_(Spring_2025)&amp;diff=12924"/>
		<updated>2025-03-05T02:58:38Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: /* Assignments */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox&lt;br /&gt;
|name         = Infobox&lt;br /&gt;
|bodystyle    = &lt;br /&gt;
|title        = &amp;lt;font size=3&amp;gt;计算方法&lt;br /&gt;
&amp;lt;br&amp;gt;Numerical method&amp;lt;/font&amp;gt;&lt;br /&gt;
|titlestyle   = &lt;br /&gt;
&lt;br /&gt;
|image        = &lt;br /&gt;
|imagestyle   = &lt;br /&gt;
|caption      = &lt;br /&gt;
|captionstyle = &lt;br /&gt;
|headerstyle  = background:#ccf;&lt;br /&gt;
|labelstyle   = background:#ddf;&lt;br /&gt;
|datastyle    = &lt;br /&gt;
&lt;br /&gt;
|header1 =Instructor&lt;br /&gt;
|label1  = &lt;br /&gt;
|data1   = &lt;br /&gt;
|header2 = &lt;br /&gt;
|label2  = &lt;br /&gt;
|data2   = 刘景铖&lt;br /&gt;
|header3 = &lt;br /&gt;
|label3  = Email&lt;br /&gt;
|data3   = liu [at] nju [dot] edu [dot] cn  &lt;br /&gt;
|header4 =&lt;br /&gt;
|label4= Office&lt;br /&gt;
|data4= 计算机系 516&lt;br /&gt;
|header5 = Class&lt;br /&gt;
|label5  = &lt;br /&gt;
|data5   = &lt;br /&gt;
|header6 =&lt;br /&gt;
|label6  = Class meetings&lt;br /&gt;
|data6   = 周三 14:00-16:00 &amp;lt;br&amp;gt; 仙 Ⅱ- 405&lt;br /&gt;
|header7 =&lt;br /&gt;
|label7  = Place&lt;br /&gt;
|data7   = &lt;br /&gt;
|header8 =&lt;br /&gt;
|label8  = &lt;br /&gt;
|data8   = &lt;br /&gt;
|header9 = Textbooks&lt;br /&gt;
|label9  = &lt;br /&gt;
|data9   = &lt;br /&gt;
|header10 =&lt;br /&gt;
|label10  = &lt;br /&gt;
|data10   = &lt;br /&gt;
|header11 =&lt;br /&gt;
|label11  = &lt;br /&gt;
|data11   =  Timothy Sauer &amp;lt;br&amp;gt;数值分析 （Numerical Analysis）（原书第2版）.&amp;lt;br&amp;gt; 机械工业出版社.&lt;br /&gt;
|header12 = Teaching Assistants&lt;br /&gt;
|data13= 侯哲，于逸潇&lt;br /&gt;
|label14= Email&lt;br /&gt;
|data14=  {houzhe, yixiaoyu} [at] smail [dot] nju [dot] edu [dot] cn&lt;br /&gt;
|label15= Office&lt;br /&gt;
|data15=计算机系 410&lt;br /&gt;
|belowstyle = background:#ddf;&lt;br /&gt;
|below = &lt;br /&gt;
}}&lt;br /&gt;
=Announcement=&lt;br /&gt;
*Welcome&lt;br /&gt;
=Course info=&lt;br /&gt;
*&#039;&#039;&#039;Instructor&#039;&#039;&#039;: 刘景铖 ( liu [at] nju [dot] edu [dot] cn )&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Teaching assistants&#039;&#039;&#039;: 侯哲，于逸潇&lt;br /&gt;
*&#039;&#039;&#039;TA email&#039;&#039;&#039;: {houzhe, yixiaoyu} [at] smail [dot] nju [dot] edu [dot] cn&lt;br /&gt;
*&#039;&#039;&#039;Homework email&#039;&#039;&#039;: nm_nju_2025@163.com&lt;br /&gt;
*&#039;&#039;&#039;Class meeting&#039;&#039;&#039;:周三 14:00-16:00， 仙 Ⅱ- 405&lt;br /&gt;
*&#039;&#039;&#039;Office hour&#039;&#039;&#039;: 周二 16:00-18:00?, 计算机系516 (subject to change)&lt;br /&gt;
*&#039;&#039;&#039;QQ群&#039;&#039;&#039;: 1019649082.(加入时需报姓名、专业、学号)&lt;br /&gt;
&lt;br /&gt;
=Textbooks and Readings=&lt;br /&gt;
*数值分析 （Numerical Analysis）（原书第2版）. Timothy Sauer.   机械工业出版社.&lt;br /&gt;
*[https://people.csail.mit.edu/jsolomon/share/book/numerical_book.pdf Numerical Algorithms: Methods for Computer Vision, Machine Learning, and Graphics.  Justin Solomon. CRC Press]&lt;br /&gt;
*[https://www.cs.yale.edu/homes/vishnoi/Lxb-Web.pdf Lx=b, Laplacian Solver and Their Algorithmic Applications.  Nisheeth K. Vishnoi.]&lt;br /&gt;
如果在获取教材方面有困难可以联系助教。(仅限英文版)&lt;br /&gt;
&lt;br /&gt;
= Collaboration on Homework =&lt;br /&gt;
You are welcome to work on homework problems in study groups of no more than 3 people; however, you must always write up the solutions on your own, listing all collaborators at the top. Similarly, you may use books or online resources to help solve homework problems, but you must always credit all such sources in your writeup and you must never copy material verbatim.&lt;br /&gt;
&lt;br /&gt;
We believe that most students can distinguish between helping other students and cheating. You may discuss approaches but your solution must be written by you and you only. You should acknowledge everyone whom you have worked with or who has given you any significant ideas about the homework.&lt;br /&gt;
&lt;br /&gt;
Further, it is your responsibility to ensure that your solutions will not be visible to other students. If you use Github or another source control system to store your solutions electronically, you must ensure your account is configured so your solutions are not publicly visible. Many popular version control systems provide free repositories to students.&lt;br /&gt;
&lt;br /&gt;
As a final note, we’d like to point out that collaboration on homework, while permitted, can be detrimental to your learning if misused. In particular, avoid collaborations where you do not contribute enough to your own satisfaction. Such a collaboration not only cheats you out of an opportunity to learn through homework, but can also affect your confidence. If you feel that you are not contributing enough to your group, then try to spend time thinking about the problems alone before working with your group. If you end up solving the problem all by yourself, that’s great! And if not, you’ll still be better prepared to contribute to your group.&lt;br /&gt;
&lt;br /&gt;
See also [http://www.acm.org/publications/policies/plagiarism_policy ACM Policy on Plagiarism].&lt;br /&gt;
&lt;br /&gt;
=Assignments=&lt;br /&gt;
Late policy: In general, we will accomodate late submission requests ONLY IF you made such requests ahead of time.&lt;br /&gt;
# [[Media:Computational Method 2025 Assignments 1.pdf| Homework1]] 请在2025年03月04日23点59分之前提交到 nm_nju_2025@163.com  (文件名为&#039;学号_姓名_A1.pdf&#039;)&lt;br /&gt;
# [[Media:Computational Method 2025 Assignments 2.pdf| Homework2]] 请在2025年03月18日23点59分之前提交到 nm_nju_2025@163.com  (文件名为&#039;学号_姓名_A2.pdf&#039;)&lt;br /&gt;
&lt;br /&gt;
=Lecture Notes=&lt;br /&gt;
如果有下载课件的问题请及时联系助教。&lt;br /&gt;
&lt;br /&gt;
# [[Media:计算方法1-2025.pdf|课程简介，函数求根]]&lt;br /&gt;
# [[Media:计算方法2-2025.pdf|牛顿法，插值，秘密分享，自纠错码]]&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=File:Computational_Method_2025_Assignments_2.pdf&amp;diff=12923</id>
		<title>File:Computational Method 2025 Assignments 2.pdf</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=File:Computational_Method_2025_Assignments_2.pdf&amp;diff=12923"/>
		<updated>2025-03-05T02:54:06Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=File:Computational_Method_2025_Assignments_1.pdf&amp;diff=12894</id>
		<title>File:Computational Method 2025 Assignments 1.pdf</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=File:Computational_Method_2025_Assignments_1.pdf&amp;diff=12894"/>
		<updated>2025-02-19T12:14:50Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: Kvrmnks reverted File:Computational Method 2025 Assignments 1.pdf to an old version&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Computational Method 2025 Assignments 1&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=File:Computational_Method_2025_Assignments_1.pdf&amp;diff=12893</id>
		<title>File:Computational Method 2025 Assignments 1.pdf</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=File:Computational_Method_2025_Assignments_1.pdf&amp;diff=12893"/>
		<updated>2025-02-19T12:12:37Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: Kvrmnks reverted File:Computational Method 2025 Assignments 1.pdf to an old version&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Computational Method 2025 Assignments 1&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=File:Computational_Method_2025_Assignments_1.pdf&amp;diff=12892</id>
		<title>File:Computational Method 2025 Assignments 1.pdf</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=File:Computational_Method_2025_Assignments_1.pdf&amp;diff=12892"/>
		<updated>2025-02-19T12:11:55Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: Kvrmnks uploaded a new version of File:Computational Method 2025 Assignments 1.pdf&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Computational Method 2025 Assignments 1&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=%E8%AE%A1%E7%AE%97%E6%96%B9%E6%B3%95_Numerical_method_(Spring_2025)&amp;diff=12891</id>
		<title>计算方法 Numerical method (Spring 2025)</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=%E8%AE%A1%E7%AE%97%E6%96%B9%E6%B3%95_Numerical_method_(Spring_2025)&amp;diff=12891"/>
		<updated>2025-02-19T12:06:05Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: /* Assignments */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox&lt;br /&gt;
|name         = Infobox&lt;br /&gt;
|bodystyle    = &lt;br /&gt;
|title        = &amp;lt;font size=3&amp;gt;计算方法&lt;br /&gt;
&amp;lt;br&amp;gt;Numerical method&amp;lt;/font&amp;gt;&lt;br /&gt;
|titlestyle   = &lt;br /&gt;
&lt;br /&gt;
|image        = &lt;br /&gt;
|imagestyle   = &lt;br /&gt;
|caption      = &lt;br /&gt;
|captionstyle = &lt;br /&gt;
|headerstyle  = background:#ccf;&lt;br /&gt;
|labelstyle   = background:#ddf;&lt;br /&gt;
|datastyle    = &lt;br /&gt;
&lt;br /&gt;
|header1 =Instructor&lt;br /&gt;
|label1  = &lt;br /&gt;
|data1   = &lt;br /&gt;
|header2 = &lt;br /&gt;
|label2  = &lt;br /&gt;
|data2   = 刘景铖&lt;br /&gt;
|header3 = &lt;br /&gt;
|label3  = Email&lt;br /&gt;
|data3   = liu [at] nju [dot] edu [dot] cn  &lt;br /&gt;
|header4 =&lt;br /&gt;
|label4= Office&lt;br /&gt;
|data4= 计算机系 516&lt;br /&gt;
|header5 = Class&lt;br /&gt;
|label5  = &lt;br /&gt;
|data5   = &lt;br /&gt;
|header6 =&lt;br /&gt;
|label6  = Class meetings&lt;br /&gt;
|data6   = 周三 14:00-16:00 &amp;lt;br&amp;gt; 仙 Ⅱ- 405&lt;br /&gt;
|header7 =&lt;br /&gt;
|label7  = Place&lt;br /&gt;
|data7   = &lt;br /&gt;
|header8 =&lt;br /&gt;
|label8  = &lt;br /&gt;
|data8   = &lt;br /&gt;
|header9 = Textbooks&lt;br /&gt;
|label9  = &lt;br /&gt;
|data9   = &lt;br /&gt;
|header10 =&lt;br /&gt;
|label10  = &lt;br /&gt;
|data10   = &lt;br /&gt;
|header11 =&lt;br /&gt;
|label11  = &lt;br /&gt;
|data11   =  Timothy Sauer &amp;lt;br&amp;gt;数值分析 （Numerical Analysis）（原书第2版）.&amp;lt;br&amp;gt; 机械工业出版社.&lt;br /&gt;
|header12 = Teaching Assistants&lt;br /&gt;
|data13= 侯哲，于逸潇&lt;br /&gt;
|label14= Email&lt;br /&gt;
|data14=  {houzhe, yixiaoyu} [at] smail [dot] nju [dot] edu [dot] cn&lt;br /&gt;
|label15= Office&lt;br /&gt;
|data15=计算机系 410&lt;br /&gt;
|belowstyle = background:#ddf;&lt;br /&gt;
|below = &lt;br /&gt;
}}&lt;br /&gt;
=Announcement=&lt;br /&gt;
*Welcome&lt;br /&gt;
=Course info=&lt;br /&gt;
*&#039;&#039;&#039;Instructor&#039;&#039;&#039;: 刘景铖 ( liu [at] nju [dot] edu [dot] cn )&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Teaching assistants&#039;&#039;&#039;: 侯哲，于逸潇&lt;br /&gt;
*&#039;&#039;&#039;TA email&#039;&#039;&#039;: {houzhe, yixiaoyu} [at] smail [dot] nju [dot] edu [dot] cn&lt;br /&gt;
*&#039;&#039;&#039;Homework email&#039;&#039;&#039;: nm_nju_2025@163.com&lt;br /&gt;
*&#039;&#039;&#039;Class meeting&#039;&#039;&#039;:周三 14:00-16:00， 仙 Ⅱ- 405&lt;br /&gt;
*&#039;&#039;&#039;Office hour&#039;&#039;&#039;: 周二 16:00-18:00?, 计算机系516 (subject to change)&lt;br /&gt;
*&#039;&#039;&#039;QQ群&#039;&#039;&#039;: 1019649082.(加入时需报姓名、专业、学号)&lt;br /&gt;
&lt;br /&gt;
=Textbooks and Readings=&lt;br /&gt;
*数值分析 （Numerical Analysis）（原书第2版）. Timothy Sauer.   机械工业出版社.&lt;br /&gt;
*[https://people.csail.mit.edu/jsolomon/share/book/numerical_book.pdf Numerical Algorithms: Methods for Computer Vision, Machine Learning, and Graphics.  Justin Solomon. CRC Press]&lt;br /&gt;
*[https://www.cs.yale.edu/homes/vishnoi/Lxb-Web.pdf Lx=b, Laplacian Solver and Their Algorithmic Applications.  Nisheeth K. Vishnoi.]&lt;br /&gt;
如果在获取教材方面有困难可以联系助教。(仅限英文版)&lt;br /&gt;
&lt;br /&gt;
= Collaboration on Homework =&lt;br /&gt;
You are welcome to work on homework problems in study groups of no more than 3 people; however, you must always write up the solutions on your own, listing all collaborators at the top. Similarly, you may use books or online resources to help solve homework problems, but you must always credit all such sources in your writeup and you must never copy material verbatim.&lt;br /&gt;
&lt;br /&gt;
We believe that most students can distinguish between helping other students and cheating. You may discuss approaches but your solution must be written by you and you only. You should acknowledge everyone whom you have worked with or who has given you any significant ideas about the homework.&lt;br /&gt;
&lt;br /&gt;
Further, it is your responsibility to ensure that your solutions will not be visible to other students. If you use Github or another source control system to store your solutions electronically, you must ensure your account is configured so your solutions are not publicly visible. Many popular version control systems provide free repositories to students.&lt;br /&gt;
&lt;br /&gt;
As a final note, we’d like to point out that collaboration on homework, while permitted, can be detrimental to your learning if misused. In particular, avoid collaborations where you do not contribute enough to your own satisfaction. Such a collaboration not only cheats you out of an opportunity to learn through homework, but can also affect your confidence. If you feel that you are not contributing enough to your group, then try to spend time thinking about the problems alone before working with your group. If you end up solving the problem all by yourself, that’s great! And if not, you’ll still be better prepared to contribute to your group.&lt;br /&gt;
&lt;br /&gt;
See also [http://www.acm.org/publications/policies/plagiarism_policy ACM Policy on Plagiarism].&lt;br /&gt;
&lt;br /&gt;
=Assignments=&lt;br /&gt;
Late policy: In general, we will accomodate late submission requests ONLY IF you made such requests ahead of time.&lt;br /&gt;
# [[Media:Computational Method 2025 Assignments 1.pdf| Homework1]] 请在2025年03月04日23点59分之前提交到 nm_nju_2025@163.com  (文件名为&#039;学号_姓名_A1.pdf&#039;)&lt;br /&gt;
&lt;br /&gt;
=Lecture Notes=&lt;br /&gt;
如果有下载课件的问题请及时联系助教。&lt;br /&gt;
&lt;br /&gt;
* [[Media:计算方法1-2025.pdf|Lecture 1]]&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=%E8%AE%A1%E7%AE%97%E6%96%B9%E6%B3%95_Numerical_method_(Spring_2025)&amp;diff=12862</id>
		<title>计算方法 Numerical method (Spring 2025)</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=%E8%AE%A1%E7%AE%97%E6%96%B9%E6%B3%95_Numerical_method_(Spring_2025)&amp;diff=12862"/>
		<updated>2025-02-17T02:25:27Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: change classroom&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox&lt;br /&gt;
|name         = Infobox&lt;br /&gt;
|bodystyle    = &lt;br /&gt;
|title        = &amp;lt;font size=3&amp;gt;计算方法&lt;br /&gt;
&amp;lt;br&amp;gt;Numerical method&amp;lt;/font&amp;gt;&lt;br /&gt;
|titlestyle   = &lt;br /&gt;
&lt;br /&gt;
|image        = &lt;br /&gt;
|imagestyle   = &lt;br /&gt;
|caption      = &lt;br /&gt;
|captionstyle = &lt;br /&gt;
|headerstyle  = background:#ccf;&lt;br /&gt;
|labelstyle   = background:#ddf;&lt;br /&gt;
|datastyle    = &lt;br /&gt;
&lt;br /&gt;
|header1 =Instructor&lt;br /&gt;
|label1  = &lt;br /&gt;
|data1   = &lt;br /&gt;
|header2 = &lt;br /&gt;
|label2  = &lt;br /&gt;
|data2   = 刘景铖&lt;br /&gt;
|header3 = &lt;br /&gt;
|label3  = Email&lt;br /&gt;
|data3   = liu [at] nju [dot] edu [dot] cn  &lt;br /&gt;
|header4 =&lt;br /&gt;
|label4= Office&lt;br /&gt;
|data4= 计算机系 516&lt;br /&gt;
|header5 = Class&lt;br /&gt;
|label5  = &lt;br /&gt;
|data5   = &lt;br /&gt;
|header6 =&lt;br /&gt;
|label6  = Class meetings&lt;br /&gt;
|data6   = 周三 14:00-16:00 &amp;lt;br&amp;gt; 仙 Ⅱ- 405&lt;br /&gt;
|header7 =&lt;br /&gt;
|label7  = Place&lt;br /&gt;
|data7   = &lt;br /&gt;
|header8 =&lt;br /&gt;
|label8  = &lt;br /&gt;
|data8   = &lt;br /&gt;
|header9 = Textbooks&lt;br /&gt;
|label9  = &lt;br /&gt;
|data9   = &lt;br /&gt;
|header10 =&lt;br /&gt;
|label10  = &lt;br /&gt;
|data10   = &lt;br /&gt;
|header11 =&lt;br /&gt;
|label11  = &lt;br /&gt;
|data11   =  Timothy Sauer &amp;lt;br&amp;gt;数值分析 （Numerical Analysis）（原书第2版）.&amp;lt;br&amp;gt; 机械工业出版社.&lt;br /&gt;
|header12 = Teaching Assistants&lt;br /&gt;
|data13= 侯哲，于逸潇&lt;br /&gt;
|label14= Email&lt;br /&gt;
|data14=  {houzhe, yixiaoyu} [at] smail [dot] nju [dot] edu [dot] cn&lt;br /&gt;
|label15= Office&lt;br /&gt;
|data15=计算机系 410&lt;br /&gt;
|belowstyle = background:#ddf;&lt;br /&gt;
|below = &lt;br /&gt;
}}&lt;br /&gt;
=Announcement=&lt;br /&gt;
*Welcome&lt;br /&gt;
=Course info=&lt;br /&gt;
*&#039;&#039;&#039;Instructor&#039;&#039;&#039;: 刘景铖 ( liu [at] nju [dot] edu [dot] cn )&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Teaching assistants&#039;&#039;&#039;: 侯哲，于逸潇&lt;br /&gt;
*&#039;&#039;&#039;TA email&#039;&#039;&#039;: {houzhe, yixiaoyu} [at] smail [dot] nju [dot] edu [dot] cn&lt;br /&gt;
*&#039;&#039;&#039;Homework email&#039;&#039;&#039;: nm_nju_2025@163.com&lt;br /&gt;
*&#039;&#039;&#039;Class meeting&#039;&#039;&#039;:周三 14:00-16:00， 仙 Ⅱ- 405&lt;br /&gt;
*&#039;&#039;&#039;Office hour&#039;&#039;&#039;: 周二 16:00-18:00?, 计算机系516 (subject to change)&lt;br /&gt;
*&#039;&#039;&#039;QQ群&#039;&#039;&#039;: 1019649082.(加入时需报姓名、专业、学号)&lt;br /&gt;
&lt;br /&gt;
=Textbooks and Readings=&lt;br /&gt;
*数值分析 （Numerical Analysis）（原书第2版）. Timothy Sauer.   机械工业出版社.&lt;br /&gt;
*[https://people.csail.mit.edu/jsolomon/share/book/numerical_book.pdf Numerical Algorithms: Methods for Computer Vision, Machine Learning, and Graphics.  Justin Solomon. CRC Press]&lt;br /&gt;
*[https://www.cs.yale.edu/homes/vishnoi/Lxb-Web.pdf Lx=b, Laplacian Solver and Their Algorithmic Applications.  Nisheeth K. Vishnoi.]&lt;br /&gt;
如果在获取教材方面有困难可以联系助教。(仅限英文版)&lt;br /&gt;
&lt;br /&gt;
= Collaboration on Homework =&lt;br /&gt;
You are welcome to work on homework problems in study groups of no more than 3 people; however, you must always write up the solutions on your own, listing all collaborators at the top. Similarly, you may use books or online resources to help solve homework problems, but you must always credit all such sources in your writeup and you must never copy material verbatim.&lt;br /&gt;
&lt;br /&gt;
We believe that most students can distinguish between helping other students and cheating. You may discuss approaches but your solution must be written by you and you only. You should acknowledge everyone whom you have worked with or who has given you any significant ideas about the homework.&lt;br /&gt;
&lt;br /&gt;
Further, it is your responsibility to ensure that your solutions will not be visible to other students. If you use Github or another source control system to store your solutions electronically, you must ensure your account is configured so your solutions are not publicly visible. Many popular version control systems provide free repositories to students.&lt;br /&gt;
&lt;br /&gt;
As a final note, we’d like to point out that collaboration on homework, while permitted, can be detrimental to your learning if misused. In particular, avoid collaborations where you do not contribute enough to your own satisfaction. Such a collaboration not only cheats you out of an opportunity to learn through homework, but can also affect your confidence. If you feel that you are not contributing enough to your group, then try to spend time thinking about the problems alone before working with your group. If you end up solving the problem all by yourself, that’s great! And if not, you’ll still be better prepared to contribute to your group.&lt;br /&gt;
&lt;br /&gt;
See also [http://www.acm.org/publications/policies/plagiarism_policy ACM Policy on Plagiarism].&lt;br /&gt;
&lt;br /&gt;
=Assignments=&lt;br /&gt;
&lt;br /&gt;
=Lecture Notes=&lt;br /&gt;
如果有下载课件的问题请及时联系助教。&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=%E8%AE%A1%E7%AE%97%E6%96%B9%E6%B3%95_Numerical_method_(Spring_2025)&amp;diff=12858</id>
		<title>计算方法 Numerical method (Spring 2025)</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=%E8%AE%A1%E7%AE%97%E6%96%B9%E6%B3%95_Numerical_method_(Spring_2025)&amp;diff=12858"/>
		<updated>2025-02-16T12:20:20Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: change email address&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox&lt;br /&gt;
|name         = Infobox&lt;br /&gt;
|bodystyle    = &lt;br /&gt;
|title        = &amp;lt;font size=3&amp;gt;计算方法&lt;br /&gt;
&amp;lt;br&amp;gt;Numerical method&amp;lt;/font&amp;gt;&lt;br /&gt;
|titlestyle   = &lt;br /&gt;
&lt;br /&gt;
|image        = &lt;br /&gt;
|imagestyle   = &lt;br /&gt;
|caption      = &lt;br /&gt;
|captionstyle = &lt;br /&gt;
|headerstyle  = background:#ccf;&lt;br /&gt;
|labelstyle   = background:#ddf;&lt;br /&gt;
|datastyle    = &lt;br /&gt;
&lt;br /&gt;
|header1 =Instructor&lt;br /&gt;
|label1  = &lt;br /&gt;
|data1   = &lt;br /&gt;
|header2 = &lt;br /&gt;
|label2  = &lt;br /&gt;
|data2   = 刘景铖&lt;br /&gt;
|header3 = &lt;br /&gt;
|label3  = Email&lt;br /&gt;
|data3   = liu [at] nju [dot] edu [dot] cn  &lt;br /&gt;
|header4 =&lt;br /&gt;
|label4= Office&lt;br /&gt;
|data4= 计算机系 516&lt;br /&gt;
|header5 = Class&lt;br /&gt;
|label5  = &lt;br /&gt;
|data5   = &lt;br /&gt;
|header6 =&lt;br /&gt;
|label6  = Class meetings&lt;br /&gt;
|data6   = 周三 14:00-16:00 &amp;lt;br&amp;gt; 仙 Ⅱ-112&lt;br /&gt;
|header7 =&lt;br /&gt;
|label7  = Place&lt;br /&gt;
|data7   = &lt;br /&gt;
|header8 =&lt;br /&gt;
|label8  = &lt;br /&gt;
|data8   = &lt;br /&gt;
|header9 = Textbooks&lt;br /&gt;
|label9  = &lt;br /&gt;
|data9   = &lt;br /&gt;
|header10 =&lt;br /&gt;
|label10  = &lt;br /&gt;
|data10   = &lt;br /&gt;
|header11 =&lt;br /&gt;
|label11  = &lt;br /&gt;
|data11   =  Timothy Sauer &amp;lt;br&amp;gt;数值分析 （Numerical Analysis）（原书第2版）.&amp;lt;br&amp;gt; 机械工业出版社.&lt;br /&gt;
|header12 = Teaching Assistants&lt;br /&gt;
|data13= 侯哲，于逸潇&lt;br /&gt;
|label14= Email&lt;br /&gt;
|data14=  {houzhe, yixiaoyu} [at] smail [dot] nju [dot] edu [dot] cn&lt;br /&gt;
|label15= Office&lt;br /&gt;
|data15=计算机系 410&lt;br /&gt;
|belowstyle = background:#ddf;&lt;br /&gt;
|below = &lt;br /&gt;
}}&lt;br /&gt;
=Announcement=&lt;br /&gt;
*Welcome&lt;br /&gt;
=Course info=&lt;br /&gt;
*&#039;&#039;&#039;Instructor&#039;&#039;&#039;: 刘景铖 ( liu [at] nju [dot] edu [dot] cn )&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Teaching assistants&#039;&#039;&#039;: 侯哲，于逸潇&lt;br /&gt;
*&#039;&#039;&#039;TA email&#039;&#039;&#039;: {houzhe, yixiaoyu} [at] smail [dot] nju [dot] edu [dot] cn&lt;br /&gt;
*&#039;&#039;&#039;Homework email&#039;&#039;&#039;: nm_nju_2025@163.com&lt;br /&gt;
*&#039;&#039;&#039;Class meeting&#039;&#039;&#039;:周三 14:00-16:00， 仙 Ⅱ-112&lt;br /&gt;
*&#039;&#039;&#039;Office hour&#039;&#039;&#039;: 周二 16:00-18:00?, 计算机系516 (subject to change)&lt;br /&gt;
*&#039;&#039;&#039;QQ群&#039;&#039;&#039;: 1019649082.(加入时需报姓名、专业、学号)&lt;br /&gt;
&lt;br /&gt;
=Textbooks and Readings=&lt;br /&gt;
*数值分析 （Numerical Analysis）（原书第2版）. Timothy Sauer.   机械工业出版社.&lt;br /&gt;
*[https://people.csail.mit.edu/jsolomon/share/book/numerical_book.pdf Numerical Algorithms: Methods for Computer Vision, Machine Learning, and Graphics.  Justin Solomon. CRC Press]&lt;br /&gt;
*[https://www.cs.yale.edu/homes/vishnoi/Lxb-Web.pdf Lx=b, Laplacian Solver and Their Algorithmic Applications.  Nisheeth K. Vishnoi.]&lt;br /&gt;
如果在获取教材方面有困难可以联系助教。(仅限英文版)&lt;br /&gt;
&lt;br /&gt;
= Collaboration on Homework =&lt;br /&gt;
You are welcome to work on homework problems in study groups of no more than 3 people; however, you must always write up the solutions on your own, listing all collaborators at the top. Similarly, you may use books or online resources to help solve homework problems, but you must always credit all such sources in your writeup and you must never copy material verbatim.&lt;br /&gt;
&lt;br /&gt;
We believe that most students can distinguish between helping other students and cheating. You may discuss approaches but your solution must be written by you and you only. You should acknowledge everyone whom you have worked with or who has given you any significant ideas about the homework.&lt;br /&gt;
&lt;br /&gt;
Further, it is your responsibility to ensure that your solutions will not be visible to other students. If you use Github or another source control system to store your solutions electronically, you must ensure your account is configured so your solutions are not publicly visible. Many popular version control systems provide free repositories to students.&lt;br /&gt;
&lt;br /&gt;
As a final note, we’d like to point out that collaboration on homework, while permitted, can be detrimental to your learning if misused. In particular, avoid collaborations where you do not contribute enough to your own satisfaction. Such a collaboration not only cheats you out of an opportunity to learn through homework, but can also affect your confidence. If you feel that you are not contributing enough to your group, then try to spend time thinking about the problems alone before working with your group. If you end up solving the problem all by yourself, that’s great! And if not, you’ll still be better prepared to contribute to your group.&lt;br /&gt;
&lt;br /&gt;
See also [http://www.acm.org/publications/policies/plagiarism_policy ACM Policy on Plagiarism].&lt;br /&gt;
&lt;br /&gt;
=Assignments=&lt;br /&gt;
&lt;br /&gt;
=Lecture Notes=&lt;br /&gt;
如果有下载课件的问题请及时联系助教。&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=Main_Page&amp;diff=12853</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=Main_Page&amp;diff=12853"/>
		<updated>2025-02-16T07:32:50Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: /* Home Pages for Courses and Seminars */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a course/seminar wiki run by the [http://tcs.nju.edu.cn theory group] in the Department of Computer Science and Technology at Nanjing University.&lt;br /&gt;
&lt;br /&gt;
== Home Pages for Courses and Seminars==&lt;br /&gt;
*[[计算方法 Numerical method (Spring 2025)|计算方法 Numerical Method (Spring 2025)]]&lt;br /&gt;
*[[高级算法 (Fall 2024)|高级算法 Advanced Algorithms (Fall 2024)]]&lt;br /&gt;
&lt;br /&gt;
*[[高级算法 (Spring 2025)|高级算法 Advanced Algorithms (Spring 2025 苏州校区)]]&lt;br /&gt;
&lt;br /&gt;
* [[概率论与数理统计 (Spring 2025)| 概率论与数理统计 Probability Theory (Spring 2025)]]&lt;br /&gt;
&lt;br /&gt;
*[[Theory Seminar|理论计算机科学讨论班]]&lt;br /&gt;
&lt;br /&gt;
*[[Study Group|理论计算机科学学习小组]]&lt;br /&gt;
&lt;br /&gt;
;Past courses&lt;br /&gt;
&lt;br /&gt;
* Advanced Algorithms: [[高级算法 (Fall 2024)|Fall 2024]], [[高级算法 (Fall 2023)|Fall 2023]], [[高级算法 (Fall 2022)|Fall 2022]], [[高级算法 (Fall 2021)|Fall 2021]], [[高级算法 (Fall 2020)|Fall 2020]], [[高级算法 (Fall 2019)|Fall 2019]], [[高级算法 (Fall 2018)|Fall 2018]], [[高级算法 (Fall 2017)|Fall 2017]], [[随机算法 \ 高级算法 (Fall 2016)|Fall 2016]].&lt;br /&gt;
&lt;br /&gt;
*Algorithm Design and Analysis: [https://tcs.nju.edu.cn/shili/courses/2024spring-algo/ Spring 2024]&lt;br /&gt;
&lt;br /&gt;
* Combinatorics: [[组合数学 (Spring 2024)|Spring 2024]], [[组合数学 (Spring 2023)|Spring 2023]], [[组合数学 (Fall 2019)|Fall 2019]], [[组合数学 (Fall 2017)|Fall 2017]], [[组合数学 (Fall 2016)|Fall 2016]], [[组合数学 (Fall 2015)|Fall 2015]], [[组合数学 (Spring 2014)|Spring 2014]], [[组合数学 (Spring 2013)|Spring 2013]], [[组合数学 (Fall 2011)|Fall 2011]], [[Combinatorics (Fall 2010)|Fall 2010]].&lt;br /&gt;
&lt;br /&gt;
* Computational Complexity: [[计算复杂性 (Spring 2025)|Spring 2025]], [[计算复杂性 (Spring 2024)|Spring 2024]], [[计算复杂性 (Spring 2023)|Spring 2023]], [[计算复杂性 (Fall 2019)|Fall 2019]], [[计算复杂性 (Fall 2018)|Fall 2018]].&lt;br /&gt;
&lt;br /&gt;
* Numerical Method: [[计算方法 Numerical method (Spring 2024)|Spring 2024]], [[计算方法 Numerical method (Spring 2023)|Spring 2023]], [https://liuexp.github.io/numerical.html Spring 2022].&lt;br /&gt;
&lt;br /&gt;
* Probability Theory: [[概率论与数理统计 (Spring 2024)|Spring 2024]], [[概率论与数理统计 (Spring 2023)|Spring 2023]].&lt;br /&gt;
&lt;br /&gt;
* Quantum Computation: [[量子计算 (Spring 2022)|Spring 2022]], [[量子计算 (Spring 2021)|Spring 2021]], [[量子计算 (Fall 2019)|Fall 2019]].&lt;br /&gt;
&lt;br /&gt;
* Randomized Algorithms:  [[随机算法 (Fall 2015)|Fall 2015]], [[随机算法 (Spring 2014)|Spring 2014]], [[随机算法 (Spring 2013)|Spring 2013]], [[随机算法 (Fall 2011)|Fall 2011]], [[Randomized Algorithms (Spring 2010)|Spring 2010]].&lt;br /&gt;
&lt;br /&gt;
;Past seminars, workshops and summer schools&lt;br /&gt;
*计算理论之美暑期学校: [[计算理论之美 (Summer 2024)|2024]], [[计算理论之美 (Summer 2023)|2023]], [[计算理论之美 (Summer 2021)|2021]]&lt;br /&gt;
*[[TCSPhD2020| 理论计算机科学优秀博士生论坛2020]]&lt;br /&gt;
*[[Quantum|量子算法与物理实现研讨会]]&lt;br /&gt;
*Nanjing Theory Day: [[Theory@Nanjing 2019|2019]], [[Theory@Nanjing 2018|2018]], [[Theory@Nanjing 2017|2017]]&lt;br /&gt;
*[[\Delta Seminar on Logic, Philosophy, and Computer Science|Δ Seminar on Logic, Philosophy, and Computer Science]]&lt;br /&gt;
*[[近似算法讨论班 (Fall 2011)|近似算法 Approximation Algorithms, Fall 2011.]]&lt;br /&gt;
&lt;br /&gt;
; 其它链接&lt;br /&gt;
* [[General Circulation(Fall 2024)|大气环流 General Circulation of the Atmosphere, Fall 2024]]&lt;br /&gt;
* [[General Circulation(Fall 2023)|大气环流 General Circulation of the Atmosphere, Fall 2023]]&lt;br /&gt;
&lt;br /&gt;
* [[概率论 (Summer 2014)| 概率与计算 (上海交大 Summer 2014)]]&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=Main_Page&amp;diff=12852</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=Main_Page&amp;diff=12852"/>
		<updated>2025-02-16T07:32:20Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: add numerical method in list /* Home Pages for Courses and Seminars */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a course/seminar wiki run by the [http://tcs.nju.edu.cn theory group] in the Department of Computer Science and Technology at Nanjing University.&lt;br /&gt;
&lt;br /&gt;
== Home Pages for Courses and Seminars==&lt;br /&gt;
*[[计算方法 Numerical method (Spring 2025)|计算方法 Numerical Method (Spring 2025)]]&lt;br /&gt;
*[[高级算法 (Fall 2024)|高级算法 Advanced Algorithms (Fall 2024)]]&lt;br /&gt;
&lt;br /&gt;
*[[高级算法 (Spring 2025)|高级算法 Advanced Algorithms (Spring 2025 苏州校区)]]&lt;br /&gt;
&lt;br /&gt;
* [[概率论与数理统计 (Spring 2025)| 概率论与数理统计 Probability Theory (Spring 2025)]]&lt;br /&gt;
&lt;br /&gt;
*[[Theory Seminar|理论计算机科学讨论班]]&lt;br /&gt;
&lt;br /&gt;
*[[Study Group|理论计算机科学学习小组]]&lt;br /&gt;
&lt;br /&gt;
;Past courses&lt;br /&gt;
&lt;br /&gt;
* Advanced Algorithms: [[高级算法 (Fall 2024)|Fall 2024]], [[高级算法 (Fall 2023)|Fall 2023]], [[高级算法 (Fall 2022)|Fall 2022]], [[高级算法 (Fall 2021)|Fall 2021]], [[高级算法 (Fall 2020)|Fall 2020]], [[高级算法 (Fall 2019)|Fall 2019]], [[高级算法 (Fall 2018)|Fall 2018]], [[高级算法 (Fall 2017)|Fall 2017]], [[随机算法 \ 高级算法 (Fall 2016)|Fall 2016]].&lt;br /&gt;
&lt;br /&gt;
*Algorithm Design and Analysis: [https://tcs.nju.edu.cn/shili/courses/2024spring-algo/ Spring 2024]&lt;br /&gt;
&lt;br /&gt;
* Combinatorics: [[组合数学 (Spring 2024)|Spring 2024]], [[组合数学 (Spring 2023)|Spring 2023]], [[组合数学 (Fall 2019)|Fall 2019]], [[组合数学 (Fall 2017)|Fall 2017]], [[组合数学 (Fall 2016)|Fall 2016]], [[组合数学 (Fall 2015)|Fall 2015]], [[组合数学 (Spring 2014)|Spring 2014]], [[组合数学 (Spring 2013)|Spring 2013]], [[组合数学 (Fall 2011)|Fall 2011]], [[Combinatorics (Fall 2010)|Fall 2010]].&lt;br /&gt;
&lt;br /&gt;
* Computational Complexity: [[计算复杂性 (Spring 2025)|Spring 2025]], [[计算复杂性 (Spring 2024)|Spring 2024]], [[计算复杂性 (Spring 2023)|Spring 2023]], [[计算复杂性 (Fall 2019)|Fall 2019]], [[计算复杂性 (Fall 2018)|Fall 2018]].&lt;br /&gt;
&lt;br /&gt;
* Numerical Method: [[计算方法 Numerical method (Spring 2025)|Spring 2025]], [[计算方法 Numerical method (Spring 2024)|Spring 2024]], [[计算方法 Numerical method (Spring 2023)|Spring 2023]], [https://liuexp.github.io/numerical.html Spring 2022].&lt;br /&gt;
&lt;br /&gt;
* Probability Theory: [[概率论与数理统计 (Spring 2024)|Spring 2024]], [[概率论与数理统计 (Spring 2023)|Spring 2023]].&lt;br /&gt;
&lt;br /&gt;
* Quantum Computation: [[量子计算 (Spring 2022)|Spring 2022]], [[量子计算 (Spring 2021)|Spring 2021]], [[量子计算 (Fall 2019)|Fall 2019]].&lt;br /&gt;
&lt;br /&gt;
* Randomized Algorithms:  [[随机算法 (Fall 2015)|Fall 2015]], [[随机算法 (Spring 2014)|Spring 2014]], [[随机算法 (Spring 2013)|Spring 2013]], [[随机算法 (Fall 2011)|Fall 2011]], [[Randomized Algorithms (Spring 2010)|Spring 2010]].&lt;br /&gt;
&lt;br /&gt;
;Past seminars, workshops and summer schools&lt;br /&gt;
*计算理论之美暑期学校: [[计算理论之美 (Summer 2024)|2024]], [[计算理论之美 (Summer 2023)|2023]], [[计算理论之美 (Summer 2021)|2021]]&lt;br /&gt;
*[[TCSPhD2020| 理论计算机科学优秀博士生论坛2020]]&lt;br /&gt;
*[[Quantum|量子算法与物理实现研讨会]]&lt;br /&gt;
*Nanjing Theory Day: [[Theory@Nanjing 2019|2019]], [[Theory@Nanjing 2018|2018]], [[Theory@Nanjing 2017|2017]]&lt;br /&gt;
*[[\Delta Seminar on Logic, Philosophy, and Computer Science|Δ Seminar on Logic, Philosophy, and Computer Science]]&lt;br /&gt;
*[[近似算法讨论班 (Fall 2011)|近似算法 Approximation Algorithms, Fall 2011.]]&lt;br /&gt;
&lt;br /&gt;
; 其它链接&lt;br /&gt;
* [[General Circulation(Fall 2024)|大气环流 General Circulation of the Atmosphere, Fall 2024]]&lt;br /&gt;
* [[General Circulation(Fall 2023)|大气环流 General Circulation of the Atmosphere, Fall 2023]]&lt;br /&gt;
&lt;br /&gt;
* [[概率论 (Summer 2014)| 概率与计算 (上海交大 Summer 2014)]]&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=%E8%AE%A1%E7%AE%97%E6%96%B9%E6%B3%95_Numerical_method_(Spring_2025)&amp;diff=12850</id>
		<title>计算方法 Numerical method (Spring 2025)</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=%E8%AE%A1%E7%AE%97%E6%96%B9%E6%B3%95_Numerical_method_(Spring_2025)&amp;diff=12850"/>
		<updated>2025-02-16T07:30:12Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: create page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox&lt;br /&gt;
|name         = Infobox&lt;br /&gt;
|bodystyle    = &lt;br /&gt;
|title        = &amp;lt;font size=3&amp;gt;计算方法&lt;br /&gt;
&amp;lt;br&amp;gt;Numerical method&amp;lt;/font&amp;gt;&lt;br /&gt;
|titlestyle   = &lt;br /&gt;
&lt;br /&gt;
|image        = &lt;br /&gt;
|imagestyle   = &lt;br /&gt;
|caption      = &lt;br /&gt;
|captionstyle = &lt;br /&gt;
|headerstyle  = background:#ccf;&lt;br /&gt;
|labelstyle   = background:#ddf;&lt;br /&gt;
|datastyle    = &lt;br /&gt;
&lt;br /&gt;
|header1 =Instructor&lt;br /&gt;
|label1  = &lt;br /&gt;
|data1   = &lt;br /&gt;
|header2 = &lt;br /&gt;
|label2  = &lt;br /&gt;
|data2   = 刘景铖&lt;br /&gt;
|header3 = &lt;br /&gt;
|label3  = Email&lt;br /&gt;
|data3   = liu [at] nju [dot] edu [dot] cn  &lt;br /&gt;
|header4 =&lt;br /&gt;
|label4= Office&lt;br /&gt;
|data4= 计算机系 516&lt;br /&gt;
|header5 = Class&lt;br /&gt;
|label5  = &lt;br /&gt;
|data5   = &lt;br /&gt;
|header6 =&lt;br /&gt;
|label6  = Class meetings&lt;br /&gt;
|data6   = 周三 14:00-16:00 &amp;lt;br&amp;gt; 仙 Ⅱ-112&lt;br /&gt;
|header7 =&lt;br /&gt;
|label7  = Place&lt;br /&gt;
|data7   = &lt;br /&gt;
|header8 =&lt;br /&gt;
|label8  = &lt;br /&gt;
|data8   = &lt;br /&gt;
|header9 = Textbooks&lt;br /&gt;
|label9  = &lt;br /&gt;
|data9   = &lt;br /&gt;
|header10 =&lt;br /&gt;
|label10  = &lt;br /&gt;
|data10   = &lt;br /&gt;
|header11 =&lt;br /&gt;
|label11  = &lt;br /&gt;
|data11   =  Timothy Sauer &amp;lt;br&amp;gt;数值分析 （Numerical Analysis）（原书第2版）.&amp;lt;br&amp;gt; 机械工业出版社.&lt;br /&gt;
|header12 = Teaching Assistants&lt;br /&gt;
|data13= 侯哲，于逸潇&lt;br /&gt;
|label14= Email&lt;br /&gt;
|data14=  {xyfu, yixiaoyu} [at] smail [dot] nju [dot] edu [dot] cn&lt;br /&gt;
|label15= Office&lt;br /&gt;
|data15=计算机系 410&lt;br /&gt;
|belowstyle = background:#ddf;&lt;br /&gt;
|below = &lt;br /&gt;
}}&lt;br /&gt;
=Announcement=&lt;br /&gt;
*Welcome&lt;br /&gt;
=Course info=&lt;br /&gt;
*&#039;&#039;&#039;Instructor&#039;&#039;&#039;: 刘景铖 ( liu [at] nju [dot] edu [dot] cn )&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Teaching assistants&#039;&#039;&#039;: 侯哲，于逸潇&lt;br /&gt;
*&#039;&#039;&#039;TA email&#039;&#039;&#039;: {xyfu, yixiaoyu} [at] smail [dot] nju [dot] edu [dot] cn&lt;br /&gt;
*&#039;&#039;&#039;Homework email&#039;&#039;&#039;: nm_nju_2024@163.com&lt;br /&gt;
*&#039;&#039;&#039;Class meeting&#039;&#039;&#039;:周三 14:00-16:00， 仙 Ⅱ-112&lt;br /&gt;
*&#039;&#039;&#039;Office hour&#039;&#039;&#039;: 周二 16:00-18:00?, 计算机系516 (subject to change)&lt;br /&gt;
*&#039;&#039;&#039;QQ群&#039;&#039;&#039;: 1019649082.(加入时需报姓名、专业、学号)&lt;br /&gt;
&lt;br /&gt;
=Textbooks and Readings=&lt;br /&gt;
*数值分析 （Numerical Analysis）（原书第2版）. Timothy Sauer.   机械工业出版社.&lt;br /&gt;
*[https://people.csail.mit.edu/jsolomon/share/book/numerical_book.pdf Numerical Algorithms: Methods for Computer Vision, Machine Learning, and Graphics.  Justin Solomon. CRC Press]&lt;br /&gt;
*[https://www.cs.yale.edu/homes/vishnoi/Lxb-Web.pdf Lx=b, Laplacian Solver and Their Algorithmic Applications.  Nisheeth K. Vishnoi.]&lt;br /&gt;
如果在获取教材方面有困难可以联系助教。(仅限英文版)&lt;br /&gt;
&lt;br /&gt;
= Collaboration on Homework =&lt;br /&gt;
You are welcome to work on homework problems in study groups of no more than 3 people; however, you must always write up the solutions on your own, listing all collaborators at the top. Similarly, you may use books or online resources to help solve homework problems, but you must always credit all such sources in your writeup and you must never copy material verbatim.&lt;br /&gt;
&lt;br /&gt;
We believe that most students can distinguish between helping other students and cheating. You may discuss approaches but your solution must be written by you and you only. You should acknowledge everyone whom you have worked with or who has given you any significant ideas about the homework.&lt;br /&gt;
&lt;br /&gt;
Further, it is your responsibility to ensure that your solutions will not be visible to other students. If you use Github or another source control system to store your solutions electronically, you must ensure your account is configured so your solutions are not publicly visible. Many popular version control systems provide free repositories to students.&lt;br /&gt;
&lt;br /&gt;
As a final note, we’d like to point out that collaboration on homework, while permitted, can be detrimental to your learning if misused. In particular, avoid collaborations where you do not contribute enough to your own satisfaction. Such a collaboration not only cheats you out of an opportunity to learn through homework, but can also affect your confidence. If you feel that you are not contributing enough to your group, then try to spend time thinking about the problems alone before working with your group. If you end up solving the problem all by yourself, that’s great! And if not, you’ll still be better prepared to contribute to your group.&lt;br /&gt;
&lt;br /&gt;
See also [http://www.acm.org/publications/policies/plagiarism_policy ACM Policy on Plagiarism].&lt;br /&gt;
&lt;br /&gt;
=Assignments=&lt;br /&gt;
&lt;br /&gt;
=Lecture Notes=&lt;br /&gt;
如果有下载课件的问题请及时联系助教。&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=Main_Page&amp;diff=12848</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=Main_Page&amp;diff=12848"/>
		<updated>2025-02-16T07:27:23Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: add numerical method 2025 /* Home Pages for Courses and Seminars */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a course/seminar wiki run by the [http://tcs.nju.edu.cn theory group] in the Department of Computer Science and Technology at Nanjing University.&lt;br /&gt;
&lt;br /&gt;
== Home Pages for Courses and Seminars==&lt;br /&gt;
*[[高级算法 (Fall 2024)|高级算法 Advanced Algorithms (Fall 2024)]]&lt;br /&gt;
&lt;br /&gt;
*[[高级算法 (Spring 2025)|高级算法 Advanced Algorithms (Spring 2025 苏州校区)]]&lt;br /&gt;
&lt;br /&gt;
* [[概率论与数理统计 (Spring 2025) | 概率论与数理统计 Probability Theory (Spring 2025)]]&lt;br /&gt;
&lt;br /&gt;
*[[Theory Seminar|理论计算机科学讨论班]]&lt;br /&gt;
&lt;br /&gt;
*[[Study Group|理论计算机科学学习小组]]&lt;br /&gt;
&lt;br /&gt;
;Past courses&lt;br /&gt;
&lt;br /&gt;
* Advanced Algorithms: [[高级算法 (Fall 2024)|Fall 2024]], [[高级算法 (Fall 2023)|Fall 2023]], [[高级算法 (Fall 2022)|Fall 2022]], [[高级算法 (Fall 2021)|Fall 2021]], [[高级算法 (Fall 2020)|Fall 2020]], [[高级算法 (Fall 2019)|Fall 2019]], [[高级算法 (Fall 2018)|Fall 2018]], [[高级算法 (Fall 2017)|Fall 2017]], [[随机算法 \ 高级算法 (Fall 2016)|Fall 2016]].&lt;br /&gt;
&lt;br /&gt;
*Algorithm Design and Analysis: [https://tcs.nju.edu.cn/shili/courses/2024spring-algo/ Spring 2024]&lt;br /&gt;
&lt;br /&gt;
* Combinatorics: [[组合数学 (Spring 2024)|Spring 2024]], [[组合数学 (Spring 2023)|Spring 2023]], [[组合数学 (Fall 2019)|Fall 2019]], [[组合数学 (Fall 2017)|Fall 2017]], [[组合数学 (Fall 2016)|Fall 2016]], [[组合数学 (Fall 2015)|Fall 2015]], [[组合数学 (Spring 2014)|Spring 2014]], [[组合数学 (Spring 2013)|Spring 2013]], [[组合数学 (Fall 2011)|Fall 2011]], [[Combinatorics (Fall 2010)|Fall 2010]].&lt;br /&gt;
&lt;br /&gt;
* Computational Complexity: [[计算复杂性 (Spring 2025)|Spring 2025]], [[计算复杂性 (Spring 2024)|Spring 2024]], [[计算复杂性 (Spring 2023)|Spring 2023]], [[计算复杂性 (Fall 2019)|Fall 2019]], [[计算复杂性 (Fall 2018)|Fall 2018]].&lt;br /&gt;
&lt;br /&gt;
* Numerical Method: [[计算方法 Numerical method (Spring 2025)|Spring 2025]], [[计算方法 Numerical method (Spring 2024)|Spring 2024]], [[计算方法 Numerical method (Spring 2023)|Spring 2023]], [https://liuexp.github.io/numerical.html Spring 2022].&lt;br /&gt;
&lt;br /&gt;
* Probability Theory: [[概率论与数理统计 (Spring 2024)|Spring 2024]], [[概率论与数理统计 (Spring 2023)|Spring 2023]].&lt;br /&gt;
&lt;br /&gt;
* Quantum Computation: [[量子计算 (Spring 2022)|Spring 2022]], [[量子计算 (Spring 2021)|Spring 2021]], [[量子计算 (Fall 2019)|Fall 2019]].&lt;br /&gt;
&lt;br /&gt;
* Randomized Algorithms:  [[随机算法 (Fall 2015)|Fall 2015]], [[随机算法 (Spring 2014)|Spring 2014]], [[随机算法 (Spring 2013)|Spring 2013]], [[随机算法 (Fall 2011)|Fall 2011]], [[Randomized Algorithms (Spring 2010)|Spring 2010]].&lt;br /&gt;
&lt;br /&gt;
;Past seminars, workshops and summer schools&lt;br /&gt;
*计算理论之美暑期学校: [[计算理论之美 (Summer 2024)|2024]], [[计算理论之美 (Summer 2023)|2023]], [[计算理论之美 (Summer 2021)|2021]]&lt;br /&gt;
*[[TCSPhD2020| 理论计算机科学优秀博士生论坛2020]]&lt;br /&gt;
*[[Quantum|量子算法与物理实现研讨会]]&lt;br /&gt;
*Nanjing Theory Day: [[Theory@Nanjing 2019|2019]], [[Theory@Nanjing 2018|2018]], [[Theory@Nanjing 2017|2017]]&lt;br /&gt;
*[[\Delta Seminar on Logic, Philosophy, and Computer Science|Δ Seminar on Logic, Philosophy, and Computer Science]]&lt;br /&gt;
*[[近似算法讨论班 (Fall 2011)|近似算法 Approximation Algorithms, Fall 2011.]]&lt;br /&gt;
&lt;br /&gt;
; 其它链接&lt;br /&gt;
* [[General Circulation(Fall 2024)|大气环流 General Circulation of the Atmosphere, Fall 2024]]&lt;br /&gt;
* [[General Circulation(Fall 2023)|大气环流 General Circulation of the Atmosphere, Fall 2023]]&lt;br /&gt;
&lt;br /&gt;
* [[概率论 (Summer 2014)| 概率与计算 (上海交大 Summer 2014)]]&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=File:Advanced_algorithm_2024_Fall_take_home_final.pdf&amp;diff=12826</id>
		<title>File:Advanced algorithm 2024 Fall take home final.pdf</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=File:Advanced_algorithm_2024_Fall_take_home_final.pdf&amp;diff=12826"/>
		<updated>2024-12-26T14:36:04Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: Kvrmnks uploaded a new version of File:Advanced algorithm 2024 Fall take home final.pdf&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=%E9%AB%98%E7%BA%A7%E7%AE%97%E6%B3%95_(Fall_2024)/Min_Cut,_Max_Cut,_and_Spectral_Cut&amp;diff=12639</id>
		<title>高级算法 (Fall 2024)/Min Cut, Max Cut, and Spectral Cut</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=%E9%AB%98%E7%BA%A7%E7%AE%97%E6%B3%95_(Fall_2024)/Min_Cut,_Max_Cut,_and_Spectral_Cut&amp;diff=12639"/>
		<updated>2024-10-04T07:49:58Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: /* Graph Cut */  Modify the definition of graph cut&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Graph Cut =&lt;br /&gt;
Let &amp;lt;math&amp;gt;G(V, E)&amp;lt;/math&amp;gt; be an undirected graph.&lt;br /&gt;
Let &amp;lt;math&amp;gt;\{S,T\}&amp;lt;/math&amp;gt; be a &#039;&#039;&#039;bipartition&#039;&#039;&#039; of &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; into nonempty subsets &amp;lt;math&amp;gt;S,T\subseteq V&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;S\cap T=\emptyset&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;S\cup T=V&amp;lt;/math&amp;gt;.  &lt;br /&gt;
&lt;br /&gt;
A cut &amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt; is defined by a bipartition &amp;lt;math&amp;gt;\{S,T\}&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; as&lt;br /&gt;
:&amp;lt;math&amp;gt;C=E(S,T)\,&amp;lt;/math&amp;gt;,&lt;br /&gt;
where &amp;lt;math&amp;gt;E(S,T)&amp;lt;/math&amp;gt; denotes the set of &amp;quot;crossing edges&amp;quot; with one endpoint in each of &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, formally defined as&lt;br /&gt;
:&amp;lt;math&amp;gt;E(S,T)=\{uv\in E\mid u\in S, v\in T\}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Given a graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;, there might be many cuts in &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;, and we are interested in finding the &#039;&#039;&#039;minimum&#039;&#039;&#039; or &#039;&#039;&#039;maximum&#039;&#039;&#039; cut.&lt;br /&gt;
&lt;br /&gt;
= Min-Cut =&lt;br /&gt;
The &#039;&#039;&#039;min-cut problem&#039;&#039;&#039;, also called the &#039;&#039;&#039;global minimum cut problem&#039;&#039;&#039;, is defined as follows.&lt;br /&gt;
{{Theorem|Min-cut problem|&lt;br /&gt;
*&#039;&#039;&#039;Input&#039;&#039;&#039;: an undirected graph &amp;lt;math&amp;gt;G(V,E)&amp;lt;/math&amp;gt;;&lt;br /&gt;
*&#039;&#039;&#039;Output&#039;&#039;&#039;: a cut &amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt; in &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; with the smallest size &amp;lt;math&amp;gt;|C|&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Equivalently, the problem asks to find a bipartition of &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; into disjoint non-empty subsets &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; that minimizes &amp;lt;math&amp;gt;|E(S,T)|&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We consider the problem in a slightly more generalized setting, where the input graphs &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; can be &#039;&#039;&#039;multi-graphs&#039;&#039;&#039;, meaning that there could be multiple &#039;&#039;&#039;parallel edges&#039;&#039;&#039; between two vertices &amp;lt;math&amp;gt;u&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt;. The cuts in multi-graphs are defined in the same way as before, and the cost of a cut &amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt; is given by the total number of edges (including parallel edges) in &amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt;. Equivalently, one may think of a multi-graph as a graph with integer edge weights, and the cost of a cut &amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt; is the total weights of all edges in &amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
A canonical deterministic algorithm for this problem is through the [http://en.wikipedia.org/wiki/Max-flow_min-cut_theorem max-flow min-cut theorem]. The max-flow algorithm finds us a minimum &#039;&#039;&#039;&amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt;-&amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; cut&#039;&#039;&#039;, which disconnects a &#039;&#039;&#039;source&#039;&#039;&#039; &amp;lt;math&amp;gt;s\in V&amp;lt;/math&amp;gt; from a &#039;&#039;&#039;sink&#039;&#039;&#039; &amp;lt;math&amp;gt;t\in V&amp;lt;/math&amp;gt;, both specified as part of the input. A global min cut can be found by exhaustively finding the minimum &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt;-&amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; cut for an arbitrarily fixed source &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; and all possible sink &amp;lt;math&amp;gt;t\neq s&amp;lt;/math&amp;gt;. This takes &amp;lt;math&amp;gt;(n-1)\times&amp;lt;/math&amp;gt;max-flow time where &amp;lt;math&amp;gt;n=|V|&amp;lt;/math&amp;gt; is the number of vertices.&lt;br /&gt;
&lt;br /&gt;
The fastest known deterministic algorithm for the minimum cut problem on multi-graphs is the [https://en.wikipedia.org/wiki/Stoer–Wagner_algorithm Stoer–Wagner algorithm], which achieves an &amp;lt;math&amp;gt;O(mn+n^2\log n)&amp;lt;/math&amp;gt; time complexity where &amp;lt;math&amp;gt;m=|E|&amp;lt;/math&amp;gt; is the total number of edges (counting the parallel edges).&lt;br /&gt;
&lt;br /&gt;
If we restrict the input to be &#039;&#039;&#039;simple graphs&#039;&#039;&#039; (meaning there is no parallel edges) with no edge weight, there are better algorithms. A deterministic algorithm of [https://dl.acm.org/citation.cfm?id=2746588 Ken-ichi Kawarabayashi and Mikkel Thorup] published in STOC 2015, achieves the near-linear (in the number of edges) time complexity.&lt;br /&gt;
&lt;br /&gt;
== Karger&#039;s &#039;&#039;Contraction&#039;&#039; algorithm ==&lt;br /&gt;
We will describe a simple and elegant randomized algorithm for the min-cut problem. The algorithm is due to [http://people.csail.mit.edu/karger/ David Karger].&lt;br /&gt;
&lt;br /&gt;
Let &amp;lt;math&amp;gt;G(V, E)&amp;lt;/math&amp;gt; be a &#039;&#039;&#039;multi-graph&#039;&#039;&#039;, which allows more than one &#039;&#039;&#039;parallel edges&#039;&#039;&#039; between two distinct vertices &amp;lt;math&amp;gt;u&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; but does not allow any &#039;&#039;&#039;self-loops&#039;&#039;&#039;: the edges that adjoin a vertex to itself. A multi-graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; can be represented by an adjacency matrix &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt;, in the way that each non-diagonal entry &amp;lt;math&amp;gt;A(u,v)&amp;lt;/math&amp;gt; takes nonnegative integer values instead of just 0 or 1, representing the number of parallel edges between &amp;lt;math&amp;gt;u&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; in &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;, and all diagonal entries &amp;lt;math&amp;gt;A(v,v)=0&amp;lt;/math&amp;gt; (since there is no self-loop).&lt;br /&gt;
&lt;br /&gt;
Given a multi-graph &amp;lt;math&amp;gt;G(V,E)&amp;lt;/math&amp;gt; and an edge &amp;lt;math&amp;gt;e\in E&amp;lt;/math&amp;gt;, we define the following &#039;&#039;&#039;contraction&#039;&#039;&#039; operator Contract(&amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;e&amp;lt;/math&amp;gt;), which transform &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; to a new multi-graph.&lt;br /&gt;
{{Theorem|The contraction operator &#039;&#039;Contract&#039;&#039;(&amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;e&amp;lt;/math&amp;gt;)|&lt;br /&gt;
:say &amp;lt;math&amp;gt;e=uv&amp;lt;/math&amp;gt;:&lt;br /&gt;
:*replace &amp;lt;math&amp;gt;\{u,v\}&amp;lt;/math&amp;gt; by a new vertex &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt;;&lt;br /&gt;
:*for every edge (no matter parallel or not) in the form of &amp;lt;math&amp;gt;uw&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;vw&amp;lt;/math&amp;gt; that connects one of &amp;lt;math&amp;gt;\{u,v\}&amp;lt;/math&amp;gt; to a vertex &amp;lt;math&amp;gt;w\in V\setminus\{u,v\}&amp;lt;/math&amp;gt; in the graph other than &amp;lt;math&amp;gt;u,v&amp;lt;/math&amp;gt;, replace it by a new edge &amp;lt;math&amp;gt;xw&amp;lt;/math&amp;gt;;&lt;br /&gt;
:*the reset of the graph does not change.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
In other words, the &amp;lt;math&amp;gt;Contract(G,uv)&amp;lt;/math&amp;gt; merges the two vertices &amp;lt;math&amp;gt;u&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; into a new vertex &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; whose incident edges preserves the edges incident to &amp;lt;math&amp;gt;u&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; in the original graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; except for the parallel edges between them. Now you should realize why we consider multi-graphs instead of simple graphs, because even if we start with a simple graph without parallel edges, the contraction operator may create parallel edges.&lt;br /&gt;
&lt;br /&gt;
The contraction operator is illustrated by the following picture:&lt;br /&gt;
[[Image:Contract.png|600px|center]]&lt;br /&gt;
&lt;br /&gt;
Karger&#039;s algorithm uses a simple idea: &lt;br /&gt;
*At each step we randomly select an edge in the current multi-graph to contract until there are only two vertices left. &lt;br /&gt;
*The parallel edges between these two remaining vertices must be a cut of the original graph. &lt;br /&gt;
*We return this cut and hope that with good chance this gives us a minimum cut.&lt;br /&gt;
The following is the pseudocode for Karger&#039;s algorithm.&lt;br /&gt;
{{Theorem|&#039;&#039;RandomContract&#039;&#039; (Karger 1993)|&lt;br /&gt;
:&#039;&#039;&#039;Input:&#039;&#039;&#039; multi-graph &amp;lt;math&amp;gt;G(V,E)&amp;lt;/math&amp;gt;;&lt;br /&gt;
----&lt;br /&gt;
:while &amp;lt;math&amp;gt;|V|&amp;gt;2&amp;lt;/math&amp;gt; do&lt;br /&gt;
:* choose an edge &amp;lt;math&amp;gt;uv\in E&amp;lt;/math&amp;gt; uniformly at random;&lt;br /&gt;
:* &amp;lt;math&amp;gt;G=Contract(G,uv)&amp;lt;/math&amp;gt;; &lt;br /&gt;
:return &amp;lt;math&amp;gt;C=E&amp;lt;/math&amp;gt; (the parallel edges between the only two vertices in &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt;);&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Another way of looking at the contraction operator Contract(&amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;e&amp;lt;/math&amp;gt;) is that we are dealing with classes of vertices. Let &amp;lt;math&amp;gt;V=\{v_1,v_2,\ldots,v_n\}&amp;lt;/math&amp;gt; be the set of all vertices. We start with &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; vertex classes &amp;lt;math&amp;gt;S_1,S_2,\ldots, S_n&amp;lt;/math&amp;gt; with each class &amp;lt;math&amp;gt;S_i=\{v_i\}&amp;lt;/math&amp;gt; contains one vertex. By calling &amp;lt;math&amp;gt;Contract(G,uv)&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;u\in S_i&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v\in S_j&amp;lt;/math&amp;gt; for distinct &amp;lt;math&amp;gt;i\neq j&amp;lt;/math&amp;gt;, we take union of &amp;lt;math&amp;gt;S_i&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;S_j&amp;lt;/math&amp;gt;. The edges in the contracted multi-graph are the edges that cross between different vertex classes.&lt;br /&gt;
&lt;br /&gt;
This view of contraction is illustrated by the following picture:&lt;br /&gt;
[[Image:Contract_class.png|600px|center]]&lt;br /&gt;
&lt;br /&gt;
The following claim is left as an exercise for the class:&lt;br /&gt;
:{|border=&amp;quot;2&amp;quot; width=&amp;quot;100%&amp;quot; cellspacing=&amp;quot;4&amp;quot; cellpadding=&amp;quot;3&amp;quot; rules=&amp;quot;all&amp;quot; style=&amp;quot;margin:1em 1em 1em 0; border:solid 1px #AAAAAA; border-collapse:collapse;empty-cells:show;&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
*With suitable choice of data structures, each operation &amp;lt;math&amp;gt;Contract(G,e)&amp;lt;/math&amp;gt; can be implemented within running time &amp;lt;math&amp;gt;O(n)&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;n=|V|&amp;lt;/math&amp;gt; is the number of vertices.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In the above &#039;&#039;&#039;&#039;&#039;RandomContract&#039;&#039;&#039;&#039;&#039; algorithm, there are precisely &amp;lt;math&amp;gt;n-2&amp;lt;/math&amp;gt; contractions. Therefore, we have the following time upper bound.&lt;br /&gt;
{{Theorem|Theorem|&lt;br /&gt;
: For any multigraph with &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; vertices, the running time of the &#039;&#039;&#039;&#039;&#039;RandomContract&#039;&#039;&#039;&#039;&#039; algorithm is &amp;lt;math&amp;gt;O(n^2)&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
We emphasize that it&#039;s the time complexity of a &amp;quot;single running&amp;quot; of the algorithm: later we will see we may need to run this algorithm for many times to guarantee a desirable accuracy.&lt;br /&gt;
&lt;br /&gt;
== Analysis of accuracy ==&lt;br /&gt;
We now analyze the performance of the above algorithm. Since the algorithm is &#039;&#039;&#039;&#039;&#039;randomized&#039;&#039;&#039;&#039;&#039;, its output cut is a random variable even when the input is fixed, so &#039;&#039;the output may not always be correct&#039;&#039;. We want to give a theoretical guarantee of the chance that the algorithm returns a correct answer on an arbitrary input.&lt;br /&gt;
&lt;br /&gt;
More precisely, on an arbitrarily fixed input multi-graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;, we want to answer the following question rigorously:&lt;br /&gt;
:&amp;lt;math&amp;gt;p_{\text{correct}}=\Pr[\,\text{a minimum cut is returned by }RandomContract\,]\ge ?&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To answer this question, we prove a stronger statement: for arbitrarily fixed input multi-graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; and a particular minimum cut &amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt; in &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;, &lt;br /&gt;
:&amp;lt;math&amp;gt;p_{C}=\Pr[\,C\mbox{ is returned by }RandomContract\,]\ge ?&amp;lt;/math&amp;gt;&lt;br /&gt;
Obviously this will imply the previous lower bound for &amp;lt;math&amp;gt;p_{\text{correct}}&amp;lt;/math&amp;gt; because the event in &amp;lt;math&amp;gt;p_{C}&amp;lt;/math&amp;gt; implies the event in &amp;lt;math&amp;gt;p_{\text{correct}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
:{|border=&amp;quot;2&amp;quot; width=&amp;quot;100%&amp;quot; cellspacing=&amp;quot;4&amp;quot; cellpadding=&amp;quot;3&amp;quot; rules=&amp;quot;all&amp;quot; style=&amp;quot;margin:1em 1em 1em 0; border:solid 1px #AAAAAA; border-collapse:collapse;empty-cells:show;&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
*In above argument we use the simple law in probability that &amp;lt;math&amp;gt;\Pr[A]\le \Pr[B]&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt;A\subseteq B&amp;lt;/math&amp;gt;, i.e. event &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; implies event &amp;lt;math&amp;gt;B&amp;lt;/math&amp;gt;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We introduce the following notations:&lt;br /&gt;
*Let &amp;lt;math&amp;gt;e_1,e_2,\ldots,e_{n-2}&amp;lt;/math&amp;gt; denote the sequence of random edges chosen to contract in a running of &#039;&#039;RandomContract&#039;&#039; algorithm. &lt;br /&gt;
*Let &amp;lt;math&amp;gt;G_1=G&amp;lt;/math&amp;gt; denote the original input multi-graph. And for &amp;lt;math&amp;gt;i=1,2,\ldots,n-2&amp;lt;/math&amp;gt;, let &amp;lt;math&amp;gt;G_{i+1}=Contract(G_{i},e_i)&amp;lt;/math&amp;gt; be the multigraph after &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;th contraction.&lt;br /&gt;
Obviously &amp;lt;math&amp;gt;e_1,e_2,\ldots,e_{n-2}&amp;lt;/math&amp;gt; are random variables, and they are the &#039;&#039;only&#039;&#039; random choices used in the algorithm: meaning that they along with the input &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;, uniquely determine the sequence of multi-graphs &amp;lt;math&amp;gt;G_1,G_2,\ldots,G_{n-2}&amp;lt;/math&amp;gt; in every iteration as well as the final output. &lt;br /&gt;
&lt;br /&gt;
We now compute the probability &amp;lt;math&amp;gt;p_C&amp;lt;/math&amp;gt; by decompose it into more elementary events involving &amp;lt;math&amp;gt;e_1,e_2,\ldots,e_{n-2}&amp;lt;/math&amp;gt;. This is due to the following proposition.&lt;br /&gt;
{{Theorem&lt;br /&gt;
|Proposition 1|&lt;br /&gt;
:If &amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt; is a minimum cut in a multi-graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;e\not\in C&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt; is still a minimum cut in the contracted graph &amp;lt;math&amp;gt;G&#039;=contract(G,e)&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
{{Proof|&lt;br /&gt;
We first observe that contraction will never create new cuts: every cut in the contracted graph &amp;lt;math&amp;gt;G&#039;&amp;lt;/math&amp;gt; must also be a cut in the original graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We then observe that a cut &amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt; in &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; &amp;quot;survives&amp;quot; in the contracted graph &amp;lt;math&amp;gt;G&#039;&amp;lt;/math&amp;gt; if and only if the contracted edge &amp;lt;math&amp;gt;e\not\in C&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Both observations are easy to verify by the definition of contraction operator (in particular, easier to verify if we take the vertex class interpretation). The detailed proofs are left as an exercise.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Recall that &amp;lt;math&amp;gt;e_1,e_2,\ldots,e_{n-2}&amp;lt;/math&amp;gt; denote the sequence of random edges chosen to contract in a running of &#039;&#039;RandomContract&#039;&#039; algorithm.&lt;br /&gt;
&lt;br /&gt;
By Proposition 1, the event &amp;lt;math&amp;gt;\mbox{``}C\mbox{ is returned by }RandomContract\mbox{&#039;&#039;}\,&amp;lt;/math&amp;gt; is equivalent to the event &amp;lt;math&amp;gt;\mbox{``}e_i\not\in C\mbox{ for all }i=1,2,\ldots,n-2\mbox{&#039;&#039;}&amp;lt;/math&amp;gt;. Therefore:&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{align}&lt;br /&gt;
p_C &lt;br /&gt;
&amp;amp;=&lt;br /&gt;
\Pr[\,C\mbox{ is returned by }{RandomContract}\,]\\&lt;br /&gt;
&amp;amp;=&lt;br /&gt;
\Pr[\,e_i\not\in C\mbox{ for all }i=1,2,\ldots,n-2\,]\\&lt;br /&gt;
&amp;amp;=&lt;br /&gt;
\prod_{i=1}^{n-2}\Pr[e_i\not\in C\mid \forall j&amp;lt;i, e_j\not\in C].&lt;br /&gt;
\end{align}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
The last equation is due to the so called &#039;&#039;&#039;chain rule&#039;&#039;&#039; in probability.&lt;br /&gt;
:{|border=&amp;quot;2&amp;quot; width=&amp;quot;100%&amp;quot; cellspacing=&amp;quot;4&amp;quot; cellpadding=&amp;quot;3&amp;quot; rules=&amp;quot;all&amp;quot; style=&amp;quot;margin:1em 1em 1em 0; border:solid 1px #AAAAAA; border-collapse:collapse;empty-cells:show;&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
*The &#039;&#039;&#039;chain rule&#039;&#039;&#039;, also known as the &#039;&#039;&#039;law of progressive conditioning&#039;&#039;&#039;, is the following proposition: for a sequence of events (not necessarily independent) &amp;lt;math&amp;gt;A_1,A_2,\ldots,A_n&amp;lt;/math&amp;gt;,&lt;br /&gt;
::&amp;lt;math&amp;gt;\Pr[\forall i, A_i]=\prod_{i=1}^n\Pr[A_i\mid \forall j&amp;lt;i, A_j]&amp;lt;/math&amp;gt;.&lt;br /&gt;
:It is a simple consequence of the definition of conditional probability. By definition of conditional probability, &lt;br /&gt;
::&amp;lt;math&amp;gt;\Pr[A_n\mid \forall j&amp;lt;n]=\frac{\Pr[\forall i, A_i]}{\Pr[\forall j&amp;lt;n, A_j]}&amp;lt;/math&amp;gt;, &lt;br /&gt;
:and equivalently we have&lt;br /&gt;
::&amp;lt;math&amp;gt;\Pr[\forall i, A_i]=\Pr[\forall j&amp;lt;n, A_j]\Pr[A_n\mid \forall j&amp;lt;n]&amp;lt;/math&amp;gt;.&lt;br /&gt;
:Recursively apply this to &amp;lt;math&amp;gt;\Pr[\forall j&amp;lt;n, A_j]&amp;lt;/math&amp;gt; we obtain the chain rule.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Back to the analysis of probability &amp;lt;math&amp;gt;p_C&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Now our task is to give lower bound to each &amp;lt;math&amp;gt;p_i=\Pr[e_i\not\in C\mid \forall j&amp;lt;i, e_j\not\in C]&amp;lt;/math&amp;gt;. The condition &amp;lt;math&amp;gt;\mbox{``}\forall j&amp;lt;i, e_j\not\in C\mbox{&#039;&#039;}&amp;lt;/math&amp;gt; means the min-cut &amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt; survives all first &amp;lt;math&amp;gt;i-1&amp;lt;/math&amp;gt; contractions &amp;lt;math&amp;gt;e_1,e_2,\ldots,e_{i-1}&amp;lt;/math&amp;gt;, which due to Proposition 1 means that &amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt; is also a min-cut in the multi-graph &amp;lt;math&amp;gt;G_i&amp;lt;/math&amp;gt; obtained from applying the first &amp;lt;math&amp;gt;(i-1)&amp;lt;/math&amp;gt; contractions.&lt;br /&gt;
&lt;br /&gt;
Then the conditional probability &amp;lt;math&amp;gt;p_i=\Pr[e_i\not\in C\mid \forall j&amp;lt;i, e_j\not\in C]&amp;lt;/math&amp;gt; is the probability that no edge in &amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt; is hit when a uniform random edge in the current multi-graph is chosen assuming that &amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt; is a minimum cut in the current multi-graph. Intuitively this probability should be bounded from below, because as a min-cut &amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt; should be sparse among all edges. This intuition is justified by the following proposition.&lt;br /&gt;
&lt;br /&gt;
{{Theorem&lt;br /&gt;
|Proposition 2|&lt;br /&gt;
:If &amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt; is a min-cut in a multi-graph &amp;lt;math&amp;gt;G(V,E)&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;|E|\ge \frac{|V||C|}{2}&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
{{Proof| &lt;br /&gt;
:It must hold that the degree of each vertex &amp;lt;math&amp;gt;v\in V&amp;lt;/math&amp;gt; is at least &amp;lt;math&amp;gt;|C|&amp;lt;/math&amp;gt;, or otherwise the set of edges incident to &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; forms a cut of size smaller than &amp;lt;math&amp;gt;|C|&amp;lt;/math&amp;gt; which separates &amp;lt;math&amp;gt;\{v\}&amp;lt;/math&amp;gt; from the rest of the graph, contradicting that &amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt; is a min-cut. And the bound &amp;lt;math&amp;gt;|E|\ge \frac{|V||C|}{2}&amp;lt;/math&amp;gt; follows directly from applying the [https://en.wikipedia.org/wiki/Handshaking_lemma handshaking lemma] to the fact that every vertex in &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; has degree at least &amp;lt;math&amp;gt;|C|&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Let &amp;lt;math&amp;gt;V_i&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_i&amp;lt;/math&amp;gt; denote the vertex set and edge set of the multi-graph &amp;lt;math&amp;gt;G_i&amp;lt;/math&amp;gt; respectively, and recall that &amp;lt;math&amp;gt;G_i&amp;lt;/math&amp;gt; is the multi-graph obtained from applying first &amp;lt;math&amp;gt;(i-1)&amp;lt;/math&amp;gt; contractions. Obviously &amp;lt;math&amp;gt;|V_{i}|=n-i+1&amp;lt;/math&amp;gt;. And due to Proposition 2, &amp;lt;math&amp;gt;|E_i|\ge \frac{|V_i||C|}{2}&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt; is still a min-cut in &amp;lt;math&amp;gt;G_i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The probability &amp;lt;math&amp;gt;p_i=\Pr[e_i\not\in C\mid \forall j&amp;lt;i, e_j\not\in C]&amp;lt;/math&amp;gt; can be computed as&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{align}&lt;br /&gt;
p_i&lt;br /&gt;
&amp;amp;=1-\frac{|C|}{|E_i|}\\&lt;br /&gt;
&amp;amp;\ge1-\frac{2}{|V_i|}\\&lt;br /&gt;
&amp;amp;=1-\frac{2}{n-i+1}&lt;br /&gt;
\end{align},&amp;lt;/math&amp;gt;&lt;br /&gt;
where the inequality is due to Proposition 2. &lt;br /&gt;
&lt;br /&gt;
We now can put everything together. We arbitrarily fix the input multi-graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; and any particular minimum cut &amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt; in &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;. &lt;br /&gt;
:&amp;lt;math&amp;gt;\begin{align}&lt;br /&gt;
p_{\text{correct}}&lt;br /&gt;
&amp;amp;=\Pr[\,\text{a minimum cut is returned by }RandomContract\,]\\&lt;br /&gt;
&amp;amp;\ge&lt;br /&gt;
\Pr[\,C\mbox{ is returned by }{RandomContract}\,]\\&lt;br /&gt;
&amp;amp;=&lt;br /&gt;
\Pr[\,e_i\not\in C\mbox{ for all }i=1,2,\ldots,n-2\,]\\&lt;br /&gt;
&amp;amp;=&lt;br /&gt;
\prod_{i=1}^{n-2}\Pr[e_i\not\in C\mid \forall j&amp;lt;i, e_j\not\in C]\\&lt;br /&gt;
&amp;amp;\ge&lt;br /&gt;
\prod_{i=1}^{n-2}\left(1-\frac{2}{n-i+1}\right)\\&lt;br /&gt;
&amp;amp;=&lt;br /&gt;
\prod_{k=3}^{n}\frac{k-2}{k}\\&lt;br /&gt;
&amp;amp;= \frac{2}{n(n-1)}.&lt;br /&gt;
\end{align}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This gives us the following theorem.&lt;br /&gt;
{{Theorem&lt;br /&gt;
|Theorem|&lt;br /&gt;
: For any multigraph with &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; vertices, the &#039;&#039;RandomContract&#039;&#039; algorithm returns a minimum cut with probability at least &amp;lt;math&amp;gt;\frac{2}{n(n-1)}&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
At first glance this seems to be a miserable chance of success. However, notice that there may be exponential many cuts in a graph (because potentially every nonempty subset &amp;lt;math&amp;gt;S\subset V&amp;lt;/math&amp;gt; corresponds to a cut &amp;lt;math&amp;gt;C=E(S,\overline{S})&amp;lt;/math&amp;gt;), and Karger&#039;s algorithm effectively reduce this exponential-sized space of feasible solutions to a quadratic size one, an exponential improvement!&lt;br /&gt;
&lt;br /&gt;
We can run &#039;&#039;RandomContract&#039;&#039; independently for &amp;lt;math&amp;gt;t=\frac{n(n-1)\ln n}{2}&amp;lt;/math&amp;gt; times and return the smallest cut ever returned. The probability that a minimum cut is found is at least:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\begin{align}&lt;br /&gt;
&amp;amp;\quad 1-\Pr[\,\mbox{all }t\mbox{ independent runnings of } RandomContract\mbox{ fails to find a min-cut}\,] \\&lt;br /&gt;
&amp;amp;= 1-\Pr[\,\mbox{a single running of }{RandomContract}\mbox{ fails}\,]^{t} \\&lt;br /&gt;
&amp;amp;\ge 1- \left(1-\frac{2}{n(n-1)}\right)^{\frac{n(n-1)\ln n}{2}} \\&lt;br /&gt;
&amp;amp;\ge 1-\frac{1}{n}.&lt;br /&gt;
\end{align}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Recall that a running of &#039;&#039;RandomContract&#039;&#039; algorithm takes &amp;lt;math&amp;gt;O(n^2)&amp;lt;/math&amp;gt; time. Altogether this gives us a randomized algorithm running in time &amp;lt;math&amp;gt;O(n^4\log n)&amp;lt;/math&amp;gt; and find a minimum cut [https://en.wikipedia.org/wiki/With_high_probability &#039;&#039;&#039;with high probability&#039;&#039;&#039;].&lt;br /&gt;
&lt;br /&gt;
== A Corollary by the Probabilistic Method ==&lt;br /&gt;
The analysis of Karger&#039;s algorithm implies the following combinatorial proposition for the number of distinct minimum cuts in a graph.&lt;br /&gt;
{{Theorem|Corollary|&lt;br /&gt;
:For any graph &amp;lt;math&amp;gt;G(V,E)&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; vertices, the number of distinct minimum cuts in &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; is at most &amp;lt;math&amp;gt;\frac{n(n-1)}{2}&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
{{Proof|&lt;br /&gt;
Let &amp;lt;math&amp;gt;\mathcal{C}&amp;lt;/math&amp;gt; denote the set of all minimum cuts in &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;. For each min-cut &amp;lt;math&amp;gt;C\in\mathcal{C}&amp;lt;/math&amp;gt;, let &amp;lt;math&amp;gt;A_C&amp;lt;/math&amp;gt; denote the event &amp;quot;&amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt; is returned by &#039;&#039;RandomContract&#039;&#039;&amp;quot;, whose probability is given by &lt;br /&gt;
:&amp;lt;math&amp;gt;p_C=\Pr[A_C]\,&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Clearly we have:&lt;br /&gt;
* for any distinct &amp;lt;math&amp;gt;C,D\in\mathcal{C}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;A_C\,&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;A_{D}\,&amp;lt;/math&amp;gt; are &#039;&#039;&#039;disjoint events&#039;&#039;&#039;; and&lt;br /&gt;
* the union &amp;lt;math&amp;gt;\bigcup_{C\in\mathcal{C}}A_C&amp;lt;/math&amp;gt; is precisely the event &amp;quot;a minimum cut is returned by &#039;&#039;RandomContract&#039;&#039;&amp;quot;, whose probability is given by&lt;br /&gt;
::&amp;lt;math&amp;gt;p_{\text{correct}}=\Pr[\,\text{a minimum cut is returned by } RandomContract\,]&amp;lt;/math&amp;gt;.&lt;br /&gt;
Due to the [https://en.wikipedia.org/wiki/Probability_axioms#Third_axiom &#039;&#039;&#039;additivity of probability&#039;&#039;&#039;], it holds that&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
p_{\text{correct}}=\sum_{C\in\mathcal{C}}\Pr[A_C]=\sum_{C\in\mathcal{C}}p_C.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By the analysis of Karger&#039;s algorithm, we know &amp;lt;math&amp;gt;p_C\ge\frac{2}{n(n-1)}&amp;lt;/math&amp;gt;. And since &amp;lt;math&amp;gt;p_{\text{correct}}&amp;lt;/math&amp;gt; is a well defined probability, due to the [https://en.wikipedia.org/wiki/Probability_axioms#Second_axiom &#039;&#039;&#039;unitarity of probability&#039;&#039;&#039;], it must hold that &amp;lt;math&amp;gt;p_{\text{correct}}\le 1&amp;lt;/math&amp;gt;. Therefore,&lt;br /&gt;
:&amp;lt;math&amp;gt;1\ge p_{\text{correct}}=\sum_{C\in\mathcal{C}}p_C\ge|\mathcal{C}|\frac{2}{n(n-1)}&amp;lt;/math&amp;gt;,&lt;br /&gt;
which means &amp;lt;math&amp;gt;|\mathcal{C}|\le\frac{n(n-1)}{2}&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Note that the statement of this theorem has no randomness at all, while the proof consists of a randomized procedure. This is an example of [http://en.wikipedia.org/wiki/Probabilistic_method the probabilistic method].&lt;br /&gt;
&lt;br /&gt;
== Fast Min-Cut ==&lt;br /&gt;
In the analysis of &#039;&#039;RandomContract&#039;&#039; algorithm, recall that we lower bound the probability &amp;lt;math&amp;gt;p_C&amp;lt;/math&amp;gt; that a min-cut &amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt; is returned by &#039;&#039;RandomContract&#039;&#039; by the following &#039;&#039;&#039;telescopic product&#039;&#039;&#039;:&lt;br /&gt;
:&amp;lt;math&amp;gt;p_C\ge\prod_{i=1}^{n-2}\left(1-\frac{2}{n-i+1}\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
Here the index &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; corresponds to the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;th contraction. The factor &amp;lt;math&amp;gt;\left(1-\frac{2}{n-i+1}\right)&amp;lt;/math&amp;gt; is decreasing in &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;, which means:&lt;br /&gt;
* The probability of success is only getting bad when the graph is getting &amp;quot;too contracted&amp;quot;, that is, when the number of remaining vertices is getting small. &lt;br /&gt;
This motivates us to consider the following alternation to the algorithm: first using random contractions to reduce the number of vertices to a moderately small number, and then recursively finding a min-cut in this smaller instance. This seems just a restatement of exactly what we have been doing. Inspired by the idea of boosting the accuracy via independent repetition, here we apply the recursion on &#039;&#039;two&#039;&#039; smaller instances generated independently.&lt;br /&gt;
&lt;br /&gt;
The algorithm obtained in this way is called &#039;&#039;FastCut&#039;&#039;. We first define a procedure to randomly contract edges until there are &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; number of vertices left.&lt;br /&gt;
&lt;br /&gt;
{{Theorem|&#039;&#039;RandomContract&#039;&#039;&amp;lt;math&amp;gt;(G, t)&amp;lt;/math&amp;gt;|&lt;br /&gt;
:&#039;&#039;&#039;Input:&#039;&#039;&#039; multi-graph &amp;lt;math&amp;gt;G(V,E)&amp;lt;/math&amp;gt;, and integer &amp;lt;math&amp;gt;t\ge 2&amp;lt;/math&amp;gt;;&lt;br /&gt;
----&lt;br /&gt;
:while &amp;lt;math&amp;gt;|V|&amp;gt;t&amp;lt;/math&amp;gt; do&lt;br /&gt;
:* choose an edge &amp;lt;math&amp;gt;uv\in E&amp;lt;/math&amp;gt; uniformly at random;&lt;br /&gt;
:* &amp;lt;math&amp;gt;G=Contract(G,uv)&amp;lt;/math&amp;gt;; &lt;br /&gt;
:return &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;FastCut&#039;&#039; algorithm is recursively defined as follows.&lt;br /&gt;
{{Theorem|&#039;&#039;FastCut&#039;&#039;&amp;lt;math&amp;gt;(G)&amp;lt;/math&amp;gt;|&lt;br /&gt;
:&#039;&#039;&#039;Input:&#039;&#039;&#039; multi-graph &amp;lt;math&amp;gt;G(V,E)&amp;lt;/math&amp;gt;;&lt;br /&gt;
----&lt;br /&gt;
:if &amp;lt;math&amp;gt;|V|\le 6&amp;lt;/math&amp;gt; then return a mincut by brute force;&lt;br /&gt;
:else let &amp;lt;math&amp;gt;t=\left\lceil1+|V|/\sqrt{2}\right\rceil&amp;lt;/math&amp;gt;;&lt;br /&gt;
:: &amp;lt;math&amp;gt;G_1=RandomContract(G,t)&amp;lt;/math&amp;gt;;&lt;br /&gt;
:: &amp;lt;math&amp;gt;G_2=RandomContract(G,t)&amp;lt;/math&amp;gt;; &lt;br /&gt;
::return the smaller one of &amp;lt;math&amp;gt;FastCut(G_1)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;FastCut(G_2)&amp;lt;/math&amp;gt;;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
As before, all &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; are multigraphs.&lt;br /&gt;
&lt;br /&gt;
Fix a min-cut &amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt; in the original multigraph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;. By the same analysis as in the case of &#039;&#039;RandomContract&#039;&#039;, we have&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{align}&lt;br /&gt;
&amp;amp;\Pr[C\text{ survives all contractions in }RandomContract(G,t)]\\&lt;br /&gt;
=&lt;br /&gt;
&amp;amp;\prod_{i=1}^{n-t}\Pr[C\text{ survives the }i\text{-th contraction}\mid C\text{ survives the first }(i-1)\text{-th contractions}]\\&lt;br /&gt;
\ge&lt;br /&gt;
&amp;amp;\prod_{i=1}^{n-t}\left(1-\frac{2}{n-i+1}\right)\\&lt;br /&gt;
=&lt;br /&gt;
&amp;amp;\prod_{k=t+1}^{n}\frac{k-2}{k}\\&lt;br /&gt;
=&lt;br /&gt;
&amp;amp;\frac{t(t-1)}{n(n-1)}.&lt;br /&gt;
\end{align}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
When &amp;lt;math&amp;gt;t=\left\lceil1+n/\sqrt{2}\right\rceil&amp;lt;/math&amp;gt;, this probability is at least &amp;lt;math&amp;gt;1/2&amp;lt;/math&amp;gt;. The choice of &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; is due to our purpose to make this probability at least &amp;lt;math&amp;gt;1/2&amp;lt;/math&amp;gt;. You will see this is crucial in the following analysis of accuracy.&lt;br /&gt;
&lt;br /&gt;
We denote by &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;B&amp;lt;/math&amp;gt; the following events:&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{align}&lt;br /&gt;
A:&lt;br /&gt;
&amp;amp;\quad C\text{  survives all contractions in }RandomContract(G,t);\\&lt;br /&gt;
B:&lt;br /&gt;
&amp;amp;\quad\text{size of min-cut is unchanged after }RandomContract(G,t);&lt;br /&gt;
\end{align}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
Clearly, &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; implies &amp;lt;math&amp;gt;B&amp;lt;/math&amp;gt; and by above analysis &amp;lt;math&amp;gt;\Pr[B]\ge\Pr[A]\ge\frac{1}{2}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We denote by &amp;lt;math&amp;gt;p(n)&amp;lt;/math&amp;gt; the lower bound on the probability that &amp;lt;math&amp;gt;FastCut(G)&amp;lt;/math&amp;gt; succeeds for a multigraph of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; vertices, that is&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
p(n)&lt;br /&gt;
=\min_{G: |V|=n}\Pr[\,FastCut(G)\text{ returns a min-cut in }G\,].&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
Suppose that &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; is the multigraph that achieves the minimum in above definition. The following recurrence holds for &amp;lt;math&amp;gt;p(n)&amp;lt;/math&amp;gt;.&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{align}&lt;br /&gt;
p(n)&lt;br /&gt;
&amp;amp;=&lt;br /&gt;
\Pr[\,FastCut(G)\text{ returns a min-cut in }G\,]\\&lt;br /&gt;
&amp;amp;=&lt;br /&gt;
\Pr[\,\text{ a min-cut of }G\text{ is returned by }FastCut(G_1)\text{ or }FastCut(G_2)\,]\\&lt;br /&gt;
&amp;amp;\ge&lt;br /&gt;
1-\left(1-\Pr[B\wedge FastCut(G_1)\text{ returns a min-cut in }G_1\,]\right)^2\\&lt;br /&gt;
&amp;amp;\ge&lt;br /&gt;
1-\left(1-\Pr[A\wedge FastCut(G_1)\text{ returns a min-cut in }G_1\,]\right)^2\\&lt;br /&gt;
&amp;amp;=&lt;br /&gt;
1-\left(1-\Pr[A]\Pr[ FastCut(G_1)\text{ returns a min-cut in }G_1\mid A]\right)^2\\&lt;br /&gt;
&amp;amp;\ge&lt;br /&gt;
1-\left(1-\frac{1}{2}p\left(\left\lceil1+n/\sqrt{2}\right\rceil\right)\right)^2,&lt;br /&gt;
\end{align}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;B&amp;lt;/math&amp;gt; are defined as above such that &amp;lt;math&amp;gt;\Pr[A]\ge\frac{1}{2}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The base case is that  &amp;lt;math&amp;gt;p(n)=1&amp;lt;/math&amp;gt; for &amp;lt;math&amp;gt;n\le 6&amp;lt;/math&amp;gt;. By induction it is easy to prove that&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
p(n)=\Omega\left(\frac{1}{\log n}\right).&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Recall that we can implement an edge contraction in &amp;lt;math&amp;gt;O(n)&amp;lt;/math&amp;gt; time, thus it is easy to verify the following recursion of time complexity:&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
T(n)=2T\left(\left\lceil1+n/\sqrt{2}\right\rceil\right)+O(n^2),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math&amp;gt;T(n)&amp;lt;/math&amp;gt; denotes the running time of &amp;lt;math&amp;gt;FastCut(G)&amp;lt;/math&amp;gt; on a multigraph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; vertices.&lt;br /&gt;
&lt;br /&gt;
By induction with the base case &amp;lt;math&amp;gt;T(n)=O(1)&amp;lt;/math&amp;gt; for &amp;lt;math&amp;gt;n\le 6&amp;lt;/math&amp;gt;, it is easy to verify that &amp;lt;math&amp;gt;T(n)=O(n^2\log n)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{{Theorem&lt;br /&gt;
|Theorem|&lt;br /&gt;
: For any multigraph with &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; vertices, the &#039;&#039;FastCut&#039;&#039; algorithm returns a minimum cut with probability &amp;lt;math&amp;gt;\Omega\left(\frac{1}{\log n}\right)&amp;lt;/math&amp;gt; in time &amp;lt;math&amp;gt;O(n^2\log n)&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
At this point, we see the name &#039;&#039;FastCut&#039;&#039; is misleading because it is actually slower than the original &#039;&#039;RandomContract&#039;&#039; algorithm, only the chance of successfully finding a min-cut is much better (improved from an &amp;lt;math&amp;gt;\Omega(1/n^2)&amp;lt;/math&amp;gt; to an &amp;lt;math&amp;gt;\Omega(1/\log n)&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
Given any input multi-graph, repeatedly running the &#039;&#039;FastCut&#039;&#039; algorithm independently for some &amp;lt;math&amp;gt;O((\log n)^2)&amp;lt;/math&amp;gt; times and returns the smallest cut ever returned, we have an algorithm which runs in time &amp;lt;math&amp;gt;O(n^2\log^3n)&amp;lt;/math&amp;gt; and returns a min-cut with probability &amp;lt;math&amp;gt;1-O(1/n)&amp;lt;/math&amp;gt;, i.e. with high probability.&lt;br /&gt;
&lt;br /&gt;
Recall that the running time of best known deterministic algorithm for min-cut on multi-graph is &amp;lt;math&amp;gt;O(mn+n^2\log n)&amp;lt;/math&amp;gt;. On dense graph, the randomized algorithm outperforms the best known deterministic algorithm.&lt;br /&gt;
&lt;br /&gt;
Finally, Karger further improves this and obtains a near-linear (in the number of edges) time [https://arxiv.org/abs/cs/9812007 randomized algorithm] for minimum cut in multi-graphs.&lt;br /&gt;
&lt;br /&gt;
= Max-Cut=&lt;br /&gt;
The &#039;&#039;&#039;maximum cut problem&#039;&#039;&#039;, in short the &#039;&#039;&#039;max-cut problem&#039;&#039;&#039;, is defined as follows.&lt;br /&gt;
{{Theorem|Max-cut problem|&lt;br /&gt;
*&#039;&#039;&#039;Input&#039;&#039;&#039;: an undirected graph &amp;lt;math&amp;gt;G(V,E)&amp;lt;/math&amp;gt;;&lt;br /&gt;
*&#039;&#039;&#039;Output&#039;&#039;&#039;: a bipartition of &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; into disjoint subsets &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; that maximizes &amp;lt;math&amp;gt;|E(S,T)|&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The problem is a typical MAX-CSP, an optimization version of the [https://en.wikipedia.org/wiki/Constraint_satisfaction_problem constraint satisfaction problem]. An instance of CSP consists of:&lt;br /&gt;
* a set of variables &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_n&amp;lt;/math&amp;gt; usually taking values from some finite domain;&lt;br /&gt;
* a sequence of constraints (predicates) &amp;lt;math&amp;gt;C_1,C_2,\ldots, C_m&amp;lt;/math&amp;gt; defined on those variables.&lt;br /&gt;
The MAX-CSP asks to find an assignment of values to variables &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_n&amp;lt;/math&amp;gt; which maximizes the number of satisfied constraints.&lt;br /&gt;
&lt;br /&gt;
In particular, when the variables &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_n&amp;lt;/math&amp;gt; takes Boolean values &amp;lt;math&amp;gt;\{0,1\}&amp;lt;/math&amp;gt; and every constraint is a binary constraint &amp;lt;math&amp;gt;\cdot\neq\cdot&amp;lt;/math&amp;gt; in the form of &amp;lt;math&amp;gt;x_1\neq x_j&amp;lt;/math&amp;gt;, then the MAX-CSP is precisely the max-cut problem.&lt;br /&gt;
&lt;br /&gt;
Unlike the min-cut problem, which can be solved in polynomial time, the max-cut is known to be [https://en.wikipedia.org/wiki/NP-hardness &#039;&#039;&#039;NP-hard&#039;&#039;&#039;]. Its decision version is among the [https://en.wikipedia.org/wiki/Karp%27s_21_NP-complete_problems 21 &#039;&#039;&#039;NP-complete&#039;&#039;&#039; problems found by Karp]. This means we should not hope for a polynomial-time algorithm for solving the problem if [https://en.wikipedia.org/wiki/P_versus_NP_problem a famous conjecture in computational complexity] is correct. And due to another [https://en.wikipedia.org/wiki/BPP_(complexity)#Problems less famous conjecture in computational complexity], randomization alone probably cannot help this situation either.&lt;br /&gt;
&lt;br /&gt;
We may compromise our goal and allow algorithm to &#039;&#039;not always find the optimal solution&#039;&#039;. However, we still want to guarantee that the algorithm &#039;&#039;always returns a relatively good solution on all possible instances&#039;&#039;. This notion is formally captured by &#039;&#039;&#039;approximation algorithms&#039;&#039;&#039; and &#039;&#039;&#039;approximation ratio&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Greedy algorithm ==&lt;br /&gt;
A natural heuristics for solving the max-cut is to sequentially join the vertices to one of the two disjoint subsets &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; to &#039;&#039;greedily&#039;&#039; maximize the &#039;&#039;current&#039;&#039; number of edges crossing between &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
To state the algorithm, we overload the definition &amp;lt;math&amp;gt;E(S,T)&amp;lt;/math&amp;gt;. Given an undirected graph &amp;lt;math&amp;gt;G(V,E)&amp;lt;/math&amp;gt;, for any disjoint subsets &amp;lt;math&amp;gt;S,T\subseteq V&amp;lt;/math&amp;gt; of vertices, we define&lt;br /&gt;
:&amp;lt;math&amp;gt;E(S,T)=\{uv\in E\mid u\in S, v\in T\}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We also assume that the vertices are ordered arbitrarily as &amp;lt;math&amp;gt;V=\{v_1,v_2,\ldots,v_n\}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The greedy heuristics is then described as follows.&lt;br /&gt;
{{Theorem|&#039;&#039;GreedyMaxCut&#039;&#039;|&lt;br /&gt;
:&#039;&#039;&#039;Input:&#039;&#039;&#039; undirected graph &amp;lt;math&amp;gt;G(V,E)&amp;lt;/math&amp;gt;, &lt;br /&gt;
:::with an arbitrary order of vertices &amp;lt;math&amp;gt;V=\{v_1,v_2,\ldots,v_n\}&amp;lt;/math&amp;gt;;&lt;br /&gt;
----&lt;br /&gt;
:initially &amp;lt;math&amp;gt;S=T=\emptyset&amp;lt;/math&amp;gt;;&lt;br /&gt;
:for &amp;lt;math&amp;gt;i=1,2,\ldots,n&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;v_i&amp;lt;/math&amp;gt; joins one of &amp;lt;math&amp;gt;S,T&amp;lt;/math&amp;gt; to maximize the current &amp;lt;math&amp;gt;|E(S,T)|&amp;lt;/math&amp;gt; (breaking ties arbitrarily);&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The algorithm certainly runs in polynomial time.&lt;br /&gt;
&lt;br /&gt;
Without any guarantee of how good the solution returned by the algorithm approximates the optimal solution, the algorithm is only a heuristics, not an &#039;&#039;&#039;approximation algorithm&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Approximation ratio ===&lt;br /&gt;
For now we restrict ourselves to the max-cut problem, although the notion applies more generally.&lt;br /&gt;
&lt;br /&gt;
Let &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; be an arbitrary instance of max-cut problem. Let &amp;lt;math&amp;gt;OPT_G&amp;lt;/math&amp;gt; denote the size of the of max-cut in graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;. More precisely,&lt;br /&gt;
:&amp;lt;math&amp;gt;OPT_G=\max_{S\subseteq V}|E(S,\overline{S})|&amp;lt;/math&amp;gt;. &lt;br /&gt;
Let &amp;lt;math&amp;gt;SOL_G&amp;lt;/math&amp;gt; be the size of of the cut &amp;lt;math&amp;gt;|E(S,T)|&amp;lt;/math&amp;gt; returned by the &#039;&#039;GreedyMaxCut&#039;&#039; algorithm on input graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
As a maximization problem it is trivial that &amp;lt;math&amp;gt;SOL_G\le OPT_G&amp;lt;/math&amp;gt; for all &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;. To guarantee that the &#039;&#039;GreedyMaxCut&#039;&#039; gives good approximation of optimal solution, we need the other direction:&lt;br /&gt;
{{Theorem|Approximation ratio|&lt;br /&gt;
:We say that the &#039;&#039;&#039;approximation ratio&#039;&#039;&#039; of the &#039;&#039;GreedyMaxCut&#039;&#039; algorithm is &amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;, or &#039;&#039;GreedyMaxCut&#039;&#039; is an &#039;&#039;&#039;&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;-approximation&#039;&#039;&#039; algorithm, for some &amp;lt;math&amp;gt;0&amp;lt;\alpha\le 1&amp;lt;/math&amp;gt;, if &lt;br /&gt;
::&amp;lt;math&amp;gt;\frac{SOL_G}{OPT_G}\ge \alpha&amp;lt;/math&amp;gt; for every possible instance &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; of max-cut.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
With this notion, we now try to analyze the approximation ratio of the &#039;&#039;GreedyMaxCut&#039;&#039; algorithm.&lt;br /&gt;
&lt;br /&gt;
A dilemma to apply this notion in our analysis is that in the definition of approximation ratio, we compare the solution returned by the algorithm with the &#039;&#039;&#039;optimal solution&#039;&#039;&#039;. However, in the analysis we can hardly conduct similar comparisons to the optimal solutions. A fallacy in this logic is that the optimal solutions are &#039;&#039;&#039;NP-hard&#039;&#039;&#039;, meaning there is no easy way to calculate them (e.g. a closed form).&lt;br /&gt;
&lt;br /&gt;
A popular step (usually the first step of analyzing approximation ratio) to avoid this dilemma is that instead of directly comparing to the optimal solution, we compare to an &#039;&#039;&#039;upper bound&#039;&#039;&#039; of the optimal solution (for minimization problem, this needs to be a lower bound), that is, we compare to something which is even better than the optimal solution (which means it cannot be realized by any feasible solution).&lt;br /&gt;
&lt;br /&gt;
For the max-cut problem, a simple upper bound to &amp;lt;math&amp;gt;OPT_G&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;|E|&amp;lt;/math&amp;gt;, the number of all edges. This is a trivial upper bound of max-cut since any cut is a subset of edges.&lt;br /&gt;
&lt;br /&gt;
Let &amp;lt;math&amp;gt;G(V,E)&amp;lt;/math&amp;gt; be the input graph and &amp;lt;math&amp;gt;V=\{v_1,v_2,\ldots,v_n\}&amp;lt;/math&amp;gt;. Initially &amp;lt;math&amp;gt;S_1=T_1=\emptyset&amp;lt;/math&amp;gt;. And for &amp;lt;math&amp;gt;i=1,2,\ldots,n&amp;lt;/math&amp;gt;, we let &amp;lt;math&amp;gt;S_{i+1}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_{i+1}&amp;lt;/math&amp;gt; be the respective &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; after &amp;lt;math&amp;gt;v_i&amp;lt;/math&amp;gt; joins one of &amp;lt;math&amp;gt;S,T&amp;lt;/math&amp;gt;. More precisely,&lt;br /&gt;
* &amp;lt;math&amp;gt;S_{i+1}=S_i\cup\{v_i\}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_{i+1}=T_i\,&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt;E(S_{i}\cup\{v_i\},T_i)&amp;gt;E(S_{i},T_i\cup\{v_i\})&amp;lt;/math&amp;gt;;&lt;br /&gt;
* &amp;lt;math&amp;gt;S_{i+1}=S_i\,&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_{i+1}=T_i\cup\{v_i\}&amp;lt;/math&amp;gt;  if otherwise. &lt;br /&gt;
Finally, the max-cut is given by&lt;br /&gt;
:&amp;lt;math&amp;gt;SOL_G=|E(S_{n+1},T_{n+1})|&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We first observe that we can count the number of edges &amp;lt;math&amp;gt;|E|&amp;lt;/math&amp;gt; by summarizing the contributions of individual &amp;lt;math&amp;gt;v_i&amp;lt;/math&amp;gt;&#039;s.&lt;br /&gt;
{{Theorem|Proposition 1|&lt;br /&gt;
:&amp;lt;math&amp;gt;|E| = \sum_{i=1}^n\left(|E(S_i,\{v_i\})|+|E(T_i,\{v_i\})|\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
{{Proof|&lt;br /&gt;
Note that &amp;lt;math&amp;gt;S_i\cup T_i=\{v_1,v_2,\ldots,v_{i-1}\}&amp;lt;/math&amp;gt;, i.e. &amp;lt;math&amp;gt;S_i&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_i&amp;lt;/math&amp;gt; together contain precisely those vertices preceding &amp;lt;math&amp;gt;v_i&amp;lt;/math&amp;gt;. Therefore, by taking the sum &lt;br /&gt;
:&amp;lt;math&amp;gt;\sum_{i=1}^n\left(|E(S_i,\{v_i\})|+|E(T_i,\{v_i\})|\right)&amp;lt;/math&amp;gt;,&lt;br /&gt;
we effectively enumerate all &amp;lt;math&amp;gt;(v_j,v_i)&amp;lt;/math&amp;gt; that &amp;lt;math&amp;gt;v_jv_i\in E&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;j&amp;lt;i&amp;lt;/math&amp;gt;. The total number is precisely &amp;lt;math&amp;gt;|E|&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
We then observe that the &amp;lt;math&amp;gt;SOL_G&amp;lt;/math&amp;gt; can be decomposed into contributions of individual &amp;lt;math&amp;gt;v_i&amp;lt;/math&amp;gt;&#039;s in the same way.&lt;br /&gt;
{{Theorem|Proposition 2|&lt;br /&gt;
:&amp;lt;math&amp;gt;SOL_G = \sum_{i=1}^n\max\left(|E(S_i, \{v_i\})|,|E(T_i, \{v_i\})|\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
{{Proof|&lt;br /&gt;
It is east to observe that &amp;lt;math&amp;gt;E(S_i,T_i)\subseteq E(S_{i+1},T_{i+1})&amp;lt;/math&amp;gt;, i.e. once an edge joins the cut between current &amp;lt;math&amp;gt;S,T&amp;lt;/math&amp;gt; it will never drop from the cut in the future. &lt;br /&gt;
&lt;br /&gt;
We then define &lt;br /&gt;
:&amp;lt;math&amp;gt;\Delta_i= |E(S_{i+1},T_{i+1})|-|E(S_i,T_i)|=|E(S_{i+1},T_{i+1})\setminus E(S_i,T_i)|&amp;lt;/math&amp;gt;&lt;br /&gt;
to be the contribution of &amp;lt;math&amp;gt;v_i&amp;lt;/math&amp;gt; in the final cut.&lt;br /&gt;
&lt;br /&gt;
It holds that&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum_{i=1}^n\Delta_i=|E(S_{n+1},T_{n+1})|-|E(S_{1},T_{1})|=|E(S_{n+1},T_{n+1})|=SOL_G&amp;lt;/math&amp;gt;.&lt;br /&gt;
On the other hand, due to the greedy rule:&lt;br /&gt;
* &amp;lt;math&amp;gt;S_{i+1}=S_i\cup\{v_i\}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_{i+1}=T_i\,&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt;E(S_{i}\cup\{v_i\},T_i)&amp;gt;E(S_{i},T_i\cup\{v_i\})&amp;lt;/math&amp;gt;;&lt;br /&gt;
* &amp;lt;math&amp;gt;S_{i+1}=S_i\,&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_{i+1}=T_i\cup\{v_i\}&amp;lt;/math&amp;gt;  if otherwise;&lt;br /&gt;
it holds that&lt;br /&gt;
:&amp;lt;math&amp;gt;\Delta_i=|E(S_{i+1},T_{i+1})\setminus E(S_i,T_i)| = \max\left(|E(S_i, \{v_i\})|,|E(T_i, \{v_i\})|\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
Together the proposition follows.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Combining the above Proposition 1 and Proposition 2, we have&lt;br /&gt;
:&amp;lt;math&amp;gt; &lt;br /&gt;
\begin{align}&lt;br /&gt;
SOL_G &lt;br /&gt;
&amp;amp;= \sum_{i=1}^n\max\left(|E(S_i, \{v_i\})|,|E(T_i, \{v_i\})|\right)\\&lt;br /&gt;
&amp;amp;\ge \frac{1}{2}\sum_{i=1}^n\left(|E(S_i, \{v_i\})|+|E(T_i, \{v_i\})|\right)\\&lt;br /&gt;
&amp;amp;=\frac{1}{2}|E|\\&lt;br /&gt;
&amp;amp;\ge\frac{1}{2}OPT_G.&lt;br /&gt;
\end{align}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Theorem|Theorem|&lt;br /&gt;
:The &#039;&#039;GreedyMaxCut&#039;&#039; is a &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;-approximation algorithm for the max-cut problem.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
This is not the best approximation ratio achieved by polynomial-time algorithms for max-cut.&lt;br /&gt;
* The best known approximation ratio achieved by any polynomial-time algorithm is achieved by the [http://www-math.mit.edu/~goemans/PAPERS/maxcut-jacm.pdf Goemans-Williamson algorithm], which relies on rounding an [https://en.wikipedia.org/wiki/Semidefinite_programming SDP] relaxation of the max-cut, and achieves an approximation ratio &amp;lt;math&amp;gt;\alpha^*\approx 0.878&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;\alpha^*&amp;lt;/math&amp;gt; is an irrational whose precise value is given by &amp;lt;math&amp;gt;\alpha^*=\frac{2}{\pi}\inf_{x\in[-1,1]}\frac{\arccos(x)}{1-x}&amp;lt;/math&amp;gt;.&lt;br /&gt;
* Assuming the [https://en.wikipedia.org/wiki/Unique_games_conjecture unique game conjecture], there does not exist any polynomial-time algorithm for max-cut with approximation ratio &amp;lt;math&amp;gt;\alpha&amp;gt;\alpha^*&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Derandomization by conditional expectation ==&lt;br /&gt;
There is a probabilistic interpretation of the greedy algorithm, which may explains why we use greedy scheme for max-cut and why it works for finding an approximate max-cut.&lt;br /&gt;
&lt;br /&gt;
Given an undirected graph &amp;lt;math&amp;gt;G(V,E)&amp;lt;/math&amp;gt;, let us calculate the average size of cuts in &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;. For every vertex &amp;lt;math&amp;gt;v\in V&amp;lt;/math&amp;gt; let &amp;lt;math&amp;gt;X_v\in\{0,1\}&amp;lt;/math&amp;gt; be a &#039;&#039;uniform&#039;&#039; and &#039;&#039;independent&#039;&#039; random bit which indicates whether &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; joins &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;. This gives us a uniform random bipartition of &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The size of the random cut &amp;lt;math&amp;gt;|E(S,T)|&amp;lt;/math&amp;gt; is given by&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
|E(S,T)| = \sum_{uv\in E} I[X_u\neq X_v],&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math&amp;gt;I[X_u\neq X_v]&amp;lt;/math&amp;gt; is the Boolean indicator random variable that indicates whether event &amp;lt;math&amp;gt;X_u\neq X_v&amp;lt;/math&amp;gt; occurs.&lt;br /&gt;
&lt;br /&gt;
Due to &#039;&#039;&#039;linearity of expectation&#039;&#039;&#039;,&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\mathbb{E}[|E(S,T)|]=\sum_{uv\in E} \mathbb{E}[I[X_u\neq X_v]] =\sum_{uv\in E} \Pr[X_u\neq X_v]=\frac{|E|}{2}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
Recall that &amp;lt;math&amp;gt;|E|&amp;lt;/math&amp;gt; is a trivial upper bound for the max-cut &amp;lt;math&amp;gt;OPT_G&amp;lt;/math&amp;gt;. Due to the above argument, we have &lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\mathbb{E}[|E(S,T)|]\ge\frac{OPT_G}{2}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
:{|border=&amp;quot;2&amp;quot; width=&amp;quot;100%&amp;quot; cellspacing=&amp;quot;4&amp;quot; cellpadding=&amp;quot;3&amp;quot; rules=&amp;quot;all&amp;quot; style=&amp;quot;margin:1em 1em 1em 0; border:solid 1px #AAAAAA; border-collapse:collapse;empty-cells:show;&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
*In above argument we use a few probability propositions.&lt;br /&gt;
: &#039;&#039;&#039;linearity of expectation:&#039;&#039;&#039;&lt;br /&gt;
:: Let &amp;lt;math&amp;gt;\boldsymbol{X}=(X_1,X_2,\ldots,X_n)&amp;lt;/math&amp;gt; be a random vector. Then&lt;br /&gt;
:::&amp;lt;math&amp;gt;\mathbb{E}\left[\sum_{i=1}^nc_iX_i\right]=\sum_{i=1}^nc_i\mathbb{E}[X_i]&amp;lt;/math&amp;gt;,&lt;br /&gt;
::where &amp;lt;math&amp;gt;c_1,c_2,\ldots,c_n&amp;lt;/math&amp;gt; are scalars.&lt;br /&gt;
::That is, the order of computations of expectation and linear (affine) function of a random vector can be exchanged. &lt;br /&gt;
::Note that this property ignores the dependency between random variables, and hence is very useful.&lt;br /&gt;
:&#039;&#039;&#039;Expectation of indicator random variable:&#039;&#039;&#039;&lt;br /&gt;
::We usually use the notation &amp;lt;math&amp;gt;I[A]&amp;lt;/math&amp;gt; to represent the Boolean indicator random variable that indicates whether the event &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; occurs: i.e. &amp;lt;math&amp;gt;I[A]=1&amp;lt;/math&amp;gt; if event &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; occurs and &amp;lt;math&amp;gt;I[A]=0&amp;lt;/math&amp;gt; if otherwise. &lt;br /&gt;
::It is easy to see that &amp;lt;math&amp;gt;\mathbb{E}[I[A]]=\Pr[A]&amp;lt;/math&amp;gt;. The expectation of an indicator random variable equals the probability of the event it indicates.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
By above analysis, the average (under uniform distribution) size of all cuts in any graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; must be at least &amp;lt;math&amp;gt;\frac{OPT_G}{2}&amp;lt;/math&amp;gt;. Due to &#039;&#039;&#039;the probabilistic method&#039;&#039;&#039;, in particular &#039;&#039;&#039;the averaging principle&#039;&#039;&#039;, there must exists a bipartition of &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; whose cut &amp;lt;math&amp;gt;E(S,T)&amp;lt;/math&amp;gt; is of size at least &amp;lt;math&amp;gt;\frac{OPT_G}{2}&amp;lt;/math&amp;gt;. Then next question is how to find such a bipartition &amp;lt;math&amp;gt;\{S,T\}&amp;lt;/math&amp;gt; &#039;&#039;algorithmically&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
We still fix an arbitrary order of all vertices as &amp;lt;math&amp;gt;V=\{v_1,v_2,\ldots,v_n\}&amp;lt;/math&amp;gt;. Recall that each vertex &amp;lt;math&amp;gt;v_i&amp;lt;/math&amp;gt; is associated with a uniform and independent random bit &amp;lt;math&amp;gt;X_{v_i}&amp;lt;/math&amp;gt; to indicate whether &amp;lt;math&amp;gt;v_i&amp;lt;/math&amp;gt; joins &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;. We want to fix the value of &amp;lt;math&amp;gt;X_{v_i}&amp;lt;/math&amp;gt; one after another to construct a bipartition &amp;lt;math&amp;gt;\{\hat{S},\hat{T}\}&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; such that &lt;br /&gt;
:&amp;lt;math&amp;gt;|E(\hat{S},\hat{T})|\ge\mathbb{E}[|E(S,T)|]\ge\frac{OPT_G}{2}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We start with the first vertex &amp;lt;math&amp;gt;v_i&amp;lt;/math&amp;gt; and its random variable &amp;lt;math&amp;gt;X_{v_1}&amp;lt;/math&amp;gt;. By the &#039;&#039;&#039;law of total expectation&#039;&#039;&#039;,&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\mathbb{E}[E(S,T)]=\frac{1}{2}\mathbb{E}[E(S,T)\mid X_{v_1}=0]+\frac{1}{2}\mathbb{E}[E(S,T)\mid X_{v_1}=1].&lt;br /&gt;
&amp;lt;/math&amp;gt; &lt;br /&gt;
There must exist an assignment &amp;lt;math&amp;gt;x_1\in\{0,1\}&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;X_{v_1}&amp;lt;/math&amp;gt; such that &lt;br /&gt;
:&amp;lt;math&amp;gt;\mathbb{E}[E(S,T)\mid X_{v_1}=x_1]\ge \mathbb{E}[E(S,T)]&amp;lt;/math&amp;gt;.&lt;br /&gt;
We can continuously applying this argument. In general, for any &amp;lt;math&amp;gt;i\le n&amp;lt;/math&amp;gt; and any particular partial assignment &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_{i-1}\in\{0,1\}&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;X_{v_1},X_{v_2},\ldots,X_{v_{i-1}}&amp;lt;/math&amp;gt;, by the law of total expectation&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{align}&lt;br /&gt;
\mathbb{E}[E(S,T)\mid X_{v_1}=x_1,\ldots, X_{v_{i-1}}=x_{i-1}]&lt;br /&gt;
=&lt;br /&gt;
&amp;amp;\frac{1}{2}\mathbb{E}[E(S,T)\mid X_{v_1}=x_1,\ldots, X_{v_{i-1}}=x_{i-1}, X_{v_{i}}=0]\\&lt;br /&gt;
&amp;amp;+\frac{1}{2}\mathbb{E}[E(S,T)\mid X_{v_1}=x_1,\ldots, X_{v_{i-1}}=x_{i-1}, X_{v_{i}}=1].&lt;br /&gt;
\end{align}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
There must exist an assignment &amp;lt;math&amp;gt;x_{i}\in\{0,1\}&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;X_{v_i}&amp;lt;/math&amp;gt; such that &lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\mathbb{E}[E(S,T)\mid X_{v_1}=x_1,\ldots, X_{v_{i}}=x_{i}]\ge \mathbb{E}[E(S,T)\mid X_{v_1}=x_1,\ldots, X_{v_{i-1}}=x_{i-1}].&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
By this argument, we can find a sequence &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_n\in\{0,1\}&amp;lt;/math&amp;gt; of bits which forms a &#039;&#039;monotone path&#039;&#039;:&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\mathbb{E}[E(S,T)]\le \cdots \le \mathbb{E}[E(S,T)\mid X_{v_1}=x_1,\ldots, X_{v_{i-1}}=x_{i-1}] \le \mathbb{E}[E(S,T)\mid X_{v_1}=x_1,\ldots, X_{v_{i}}=x_{i}] \le \cdots \le  \mathbb{E}[E(S,T)\mid X_{v_1}=x_1,\ldots, X_{v_{n}}=x_{n}].&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
We already know the first step of this monotone path &amp;lt;math&amp;gt;\mathbb{E}[E(S,T)]\ge\frac{OPT_G}{2}&amp;lt;/math&amp;gt;. And for the last step of the monotone path &amp;lt;math&amp;gt;\mathbb{E}[E(S,T)\mid X_{v_1}=x_1,\ldots, X_{v_{n}}=x_{n}]&amp;lt;/math&amp;gt; since all random bits have been fixed, a bipartition &amp;lt;math&amp;gt;(\hat{S},\hat{T})&amp;lt;/math&amp;gt; is determined by the assignment &amp;lt;math&amp;gt;x_1,\ldots, x_n&amp;lt;/math&amp;gt;, so the expectation has no effect except just retuning the size of that cut &amp;lt;math&amp;gt;|E(\hat{S},\hat{T})|&amp;lt;/math&amp;gt;. We found the cut &amp;lt;math&amp;gt;E(\hat{S},\hat{T})&amp;lt;/math&amp;gt; such that &amp;lt;math&amp;gt;|E(\hat{S},\hat{T})|\ge \frac{OPT_G}{2}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We translate the procedure of constructing this monotone path of conditional expectation to the following algorithm. &lt;br /&gt;
{{Theorem|&#039;&#039;MonotonePath&#039;&#039;|&lt;br /&gt;
:&#039;&#039;&#039;Input:&#039;&#039;&#039; undirected graph &amp;lt;math&amp;gt;G(V,E)&amp;lt;/math&amp;gt;, &lt;br /&gt;
:::with an arbitrary order of vertices &amp;lt;math&amp;gt;V=\{v_1,v_2,\ldots,v_n\}&amp;lt;/math&amp;gt;;&lt;br /&gt;
----&lt;br /&gt;
:initially &amp;lt;math&amp;gt;S=T=\emptyset&amp;lt;/math&amp;gt;;&lt;br /&gt;
:for &amp;lt;math&amp;gt;i=1,2,\ldots,n&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;v_i&amp;lt;/math&amp;gt; joins one of &amp;lt;math&amp;gt;S,T&amp;lt;/math&amp;gt; to maximize the average size of cut conditioning on the choices made so far by the vertices &amp;lt;math&amp;gt;v_1,v_2,\ldots,v_i&amp;lt;/math&amp;gt;;&lt;br /&gt;
}}&lt;br /&gt;
We leave as an exercise to verify that the choice of each &amp;lt;math&amp;gt;v_i&amp;lt;/math&amp;gt; (to join which one of &amp;lt;math&amp;gt;S,T&amp;lt;/math&amp;gt;) in the &#039;&#039;MonotonePath&#039;&#039; algorithm (which maximizes the average size of cut conditioning on the choices made so far by the vertices &amp;lt;math&amp;gt;v_1,v_2,\ldots,v_i&amp;lt;/math&amp;gt;) must be the same choice made by &amp;lt;math&amp;gt;v_i&amp;lt;/math&amp;gt; in the &#039;&#039;GreedyMaxCut&#039;&#039; algorithm (which maximizes the current &amp;lt;math&amp;gt;|E(S,T)|&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
Therefore, the greedy algorithm for max-cut is actually due to a derandomization of average-case.&lt;br /&gt;
&lt;br /&gt;
== Derandomization by pairwise independence ==&lt;br /&gt;
We still construct a random bipartition of &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;. But this time the random choices have &#039;&#039;&#039;bounded independence&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
For each vertex &amp;lt;math&amp;gt;v\in V&amp;lt;/math&amp;gt;, we use a Boolean random variable &amp;lt;math&amp;gt;Y_v\in\{0,1\}&amp;lt;/math&amp;gt; to indicate whether &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; joins &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;. The dependencies between &amp;lt;math&amp;gt;Y_v&amp;lt;/math&amp;gt;&#039;s are to be specified later.&lt;br /&gt;
&lt;br /&gt;
By linearity of expectation, regardless of the dependencies between &amp;lt;math&amp;gt;Y_v&amp;lt;/math&amp;gt;&#039;s, it holds that:&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\mathbb{E}[|E(S,T)|]=\sum_{uv\in E} \Pr[Y_u\neq Y_v].&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
In order to have the average cut &amp;lt;math&amp;gt;\mathbb{E}[|E(S,T)|]=\frac{|E|}{2}&amp;lt;/math&amp;gt; as the fully random case, we need &amp;lt;math&amp;gt;\Pr[Y_u\neq Y_v]=\frac{1}{2}&amp;lt;/math&amp;gt;. This only requires that the Boolean random variables &amp;lt;math&amp;gt;Y_v&amp;lt;/math&amp;gt;&#039;s are uniform and &#039;&#039;&#039;pairwise independent&#039;&#039;&#039; instead of being &#039;&#039;&#039;mutually independent&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; pairwise independent random bits &amp;lt;math&amp;gt;\{Y_v\}_{v\in V}&amp;lt;/math&amp;gt; can be constructed by at most &amp;lt;math&amp;gt;k=\lceil\log (n+1)\rceil&amp;lt;/math&amp;gt; mutually independent random bits &amp;lt;math&amp;gt;X_1,X_2,\ldots,X_k\in\{0,1\}&amp;lt;/math&amp;gt; by the following standard routine.&lt;br /&gt;
&lt;br /&gt;
{{Theorem|Theorem|&lt;br /&gt;
:Let &amp;lt;math&amp;gt;X_1, X_2, \ldots, X_k\in\{0,1\}&amp;lt;/math&amp;gt; be mutually independent uniform random bits. &lt;br /&gt;
:Let &amp;lt;math&amp;gt;S_1, S_2, \ldots, S_{2^k-1}\subseteq \{1,2,\ldots,k\}&amp;lt;/math&amp;gt; enumerate the &amp;lt;math&amp;gt;2^k-1&amp;lt;/math&amp;gt; nonempty subsets of &amp;lt;math&amp;gt;\{1,2,\ldots,k\}&amp;lt;/math&amp;gt;. &lt;br /&gt;
:For each &amp;lt;math&amp;gt;i\le i\le2^k-1&amp;lt;/math&amp;gt;, let &lt;br /&gt;
::&amp;lt;math&amp;gt;Y_i=\bigoplus_{j\in S_i}X_j=\left(\sum_{j\in S_i}X_j\right)\bmod 2.&amp;lt;/math&amp;gt;&lt;br /&gt;
:Then &amp;lt;math&amp;gt;Y_1,Y_2,\ldots,Y_{2^k-1}&amp;lt;/math&amp;gt; are pairwise independent uniform random bits.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;math&amp;gt;Y_v&amp;lt;/math&amp;gt; for each vertex &amp;lt;math&amp;gt;v\in V&amp;lt;/math&amp;gt; is constructed in this way by at most &amp;lt;math&amp;gt;k=\lceil\log (n+1)\rceil&amp;lt;/math&amp;gt; mutually independent random bits &amp;lt;math&amp;gt;X_1,X_2,\ldots,X_k\in\{0,1\}&amp;lt;/math&amp;gt;, then they are uniform and pairwise independent, which by the above calculation, it holds for the corresponding bipartition &amp;lt;math&amp;gt;\{S,T\}&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; that&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\mathbb{E}[|E(S,T)|]=\sum_{uv\in E} \Pr[Y_u\neq Y_v]=\frac{|E|}{2}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
Note that the average is taken over the random choices of &amp;lt;math&amp;gt;X_1,X_2,\ldots,X_k\in\{0,1\}&amp;lt;/math&amp;gt; (because they are the only random choices used to construct the bipartition &amp;lt;math&amp;gt;\{S,T\}&amp;lt;/math&amp;gt;). By the probabilistic method, there must exist an assignment of &amp;lt;math&amp;gt;X_1,X_2,\ldots,X_k\in\{0,1\}&amp;lt;/math&amp;gt; such that the corresponding &amp;lt;math&amp;gt;Y_v&amp;lt;/math&amp;gt;&#039;s and the bipartition &amp;lt;math&amp;gt;\{S,T\}&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; indicated by the &amp;lt;math&amp;gt;Y_v&amp;lt;/math&amp;gt;&#039;s have that &lt;br /&gt;
:&amp;lt;math&amp;gt;|E(S,T)|\ge \frac{|E|}{2}\ge\frac{OPT}{2}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
This gives us the following algorithm for exhaustive search in a smaller solution space of size &amp;lt;math&amp;gt;2^k-1=O(n^2)&amp;lt;/math&amp;gt;.&lt;br /&gt;
{{Theorem|Algorithm|&lt;br /&gt;
:Enumerate vertices as &amp;lt;math&amp;gt;V=\{v_1,v_2,\ldots,v_n\}&amp;lt;/math&amp;gt;;&lt;br /&gt;
:let &amp;lt;math&amp;gt;k=\lceil\log (n+1)\rceil&amp;lt;/math&amp;gt;;&lt;br /&gt;
:for all &amp;lt;math&amp;gt;\vec{x}\in\{0,1\}^k&amp;lt;/math&amp;gt;&lt;br /&gt;
::initialize &amp;lt;math&amp;gt;S_{\vec{x}}=T_{\vec{x}}=\emptyset&amp;lt;/math&amp;gt;;&lt;br /&gt;
::for &amp;lt;math&amp;gt;i=1, 2, \ldots, n&amp;lt;/math&amp;gt;&lt;br /&gt;
:::if &amp;lt;math&amp;gt;\bigoplus_{j:\lfloor i/2^j\rfloor\bmod 2=1}x_j=1&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;v_i&amp;lt;/math&amp;gt; joins &amp;lt;math&amp;gt;S_{\vec{x}}&amp;lt;/math&amp;gt;;&lt;br /&gt;
:::else &amp;lt;math&amp;gt;v_i&amp;lt;/math&amp;gt; joins &amp;lt;math&amp;gt;T_{\vec{x}}&amp;lt;/math&amp;gt;;&lt;br /&gt;
:return the &amp;lt;math&amp;gt;\{S_{\vec{x}},T_{\vec{x}}\}&amp;lt;/math&amp;gt; with the largest &amp;lt;math&amp;gt;|E(S_{\vec{x}},T_{\vec{x}})|&amp;lt;/math&amp;gt;;&lt;br /&gt;
}}&lt;br /&gt;
The algorithm has approximation ratio 1/2 and runs in polynomial time.&lt;br /&gt;
&lt;br /&gt;
= Spectral Cut =&lt;br /&gt;
== Expansion, Conductance and Sparsest Cut in Regular Graphs==&lt;br /&gt;
Consider an undirected &amp;lt;math&amp;gt;d&amp;lt;/math&amp;gt;-regular (multi-)graph &amp;lt;math&amp;gt;G(V,E)&amp;lt;/math&amp;gt;, where the parallel edges between two vertices are allowed.&lt;br /&gt;
For &amp;lt;math&amp;gt;S,T\subset V&amp;lt;/math&amp;gt;, let &amp;lt;math&amp;gt;E(S,T)=\{uv\in E\mid u\in S,v\in T\}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Theorem&lt;br /&gt;
|Definition (Edge expansion)|&lt;br /&gt;
:The &#039;&#039;&#039;Edge expansion&#039;&#039;&#039; of an undirected graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; on &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; vertices, is defined as&lt;br /&gt;
::&amp;lt;math&amp;gt;&lt;br /&gt;
h(G)=\min_{\overset{S\subset V}{|S|\le\frac{n}{2}}} \frac{|E(S, \bar{S}|}{|S|}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
As a side note, the edge expansion in a irregular graph has exactly the same definition.&lt;br /&gt;
The edge expansion is a very hard to approximate problem. Under the [https://en.wikipedia.org/wiki/Unique_games_conjecture Unique games conjecture], it is NP-hard to approximate within constant factors.&lt;br /&gt;
&lt;br /&gt;
{{Theorem&lt;br /&gt;
|Definition (Conductance)|&lt;br /&gt;
:The &#039;&#039;&#039;Conductance&#039;&#039;&#039; of an undirected graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; on &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; vertices, is defined as&lt;br /&gt;
::&amp;lt;math&amp;gt;&lt;br /&gt;
\varphi(G)=h(G)/d.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Theorem&lt;br /&gt;
|Definition (Sparsest cut)|&lt;br /&gt;
:The &#039;&#039;&#039;Sparsest cut&#039;&#039;&#039; of an undirected graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; on &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; vertices, is a set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; minimizing&lt;br /&gt;
::&amp;lt;math&amp;gt;&lt;br /&gt;
\frac{|E(S, \bar{S}|}{\min\{|S|,|\bar{S}|\}}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Spectrum of Regular Graphs==&lt;br /&gt;
The &#039;&#039;&#039;adjacency matrix&#039;&#039;&#039; of an &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;-vertex graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;, denoted &amp;lt;math&amp;gt;A = A(G)&amp;lt;/math&amp;gt;, is an &amp;lt;math&amp;gt;n\times n&amp;lt;/math&amp;gt; matrix where &amp;lt;math&amp;gt;A(u,v)&amp;lt;/math&amp;gt; is the number of edges in &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; between vertex &amp;lt;math&amp;gt;u&amp;lt;/math&amp;gt; and vertex &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt;. Because &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; is a symmetric matrix with real entries, due to the [https://en.wikipedia.org/wiki/Spectral_theorem Spectral theorem], it has real eigenvalues &amp;lt;math&amp;gt;\lambda_1\ge\lambda_2\ge\cdots\ge\lambda_n&amp;lt;/math&amp;gt;, which associate with an orthonormal system of eigenvectors &amp;lt;math&amp;gt;v_1,v_2,\ldots, v_n\,&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;Av_i=\lambda_i v_i\,&amp;lt;/math&amp;gt;. We call the eigenvalues of &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; the &#039;&#039;&#039;spectrum&#039;&#039;&#039; of the graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The spectrum of a graph carries a lot of information about the graph. For example, suppose that &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;d&amp;lt;/math&amp;gt;-regular, the following lemma holds.&lt;br /&gt;
{{Theorem&lt;br /&gt;
|Lemma|&lt;br /&gt;
# &amp;lt;math&amp;gt;|\lambda_i|\le d&amp;lt;/math&amp;gt; for all &amp;lt;math&amp;gt;1\le i\le n&amp;lt;/math&amp;gt;.&lt;br /&gt;
# &amp;lt;math&amp;gt;\lambda_1=d&amp;lt;/math&amp;gt; and the corresponding eigenvector is &amp;lt;math&amp;gt;\vec{1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
# &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; is connected if and only if &amp;lt;math&amp;gt;\lambda_2&amp;lt;\lambda_1&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
{{Proof| Let &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; be the adjacency matrix of &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;, with entries &amp;lt;math&amp;gt;a_{ij}&amp;lt;/math&amp;gt;. It is obvious that &amp;lt;math&amp;gt;\sum_{j}a_{ij}=d\,&amp;lt;/math&amp;gt; for any &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt;.&lt;br /&gt;
*(1) Suppose that &amp;lt;math&amp;gt;Ax=\lambda x, x\neq \mathbf{0}&amp;lt;/math&amp;gt;, and let &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt; be an entry of &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; with the largest absolute value. Since &amp;lt;math&amp;gt;(Ax)_i=\lambda x_i&amp;lt;/math&amp;gt;, we have &lt;br /&gt;
::&amp;lt;math&amp;gt;&lt;br /&gt;
\sum_{j}a_{ij}x_j=\lambda x_i,\,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
:and so&lt;br /&gt;
::&amp;lt;math&amp;gt;&lt;br /&gt;
|\lambda||x_i|=\left|\sum_{j}a_{ij}x_j\right|\le \sum_{j}a_{ij}|x_j|\le \sum_{j}a_{ij}|x_i| \le d|x_i|.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
:Thus &amp;lt;math&amp;gt;|\lambda|\le d&amp;lt;/math&amp;gt;.&lt;br /&gt;
*(2) is easy to check.&lt;br /&gt;
*(3) Suppose that &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; is connected. Let &amp;lt;math&amp;gt;x\neq 0&amp;lt;/math&amp;gt; be an eigenvector for which &amp;lt;math&amp;gt;Ax=dx&amp;lt;/math&amp;gt;. Without loss of generality we can assume that &amp;lt;math&amp;gt;\max_i x_i&amp;gt;0 &amp;lt;/math&amp;gt;.&lt;br /&gt;
:We first show that &amp;lt;math&amp;gt;\forall i\left(x_i = \max_j x_j \implies \forall k\sim i, x_k=x_i \right).&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:This claim will imply that &amp;lt;math&amp;gt;x=c\vec{1}&amp;lt;/math&amp;gt; for a connected graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;, so we prove it next, by contradiction. &lt;br /&gt;
:Let &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt; be an entry of &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; with the largest absolute value. Suppose that &amp;lt;math&amp;gt;\exists k\sim i, x_k &amp;lt; x_i&amp;lt;/math&amp;gt;. Since &amp;lt;math&amp;gt;\sum_{j}a_{ij}=d&amp;lt;/math&amp;gt; and $x_j \le x_i$, we have &lt;br /&gt;
::&amp;lt;math&amp;gt;&lt;br /&gt;
\sum_{j}a_{ij}x_j &amp;lt; d x_i.\,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
:However,&lt;br /&gt;
::&amp;lt;math&amp;gt;&lt;br /&gt;
(Ax)_i=d x_i \implies \sum_{j}a_{ij}x_j=d x_i.\,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
:A contradiction. So it follows that &amp;lt;math&amp;gt;x_j=x_i&amp;lt;/math&amp;gt; for all &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;a_{ij}&amp;gt;0&amp;lt;/math&amp;gt;, which verifies the claim. Since &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; is connected, &amp;lt;math&amp;gt;x=c\vec{1}&amp;lt;/math&amp;gt;, and the eigenvalue &amp;lt;math&amp;gt;d=\lambda_1&amp;lt;/math&amp;gt; has multiplicity 1, thus &amp;lt;math&amp;gt;\lambda_1&amp;gt;\lambda_2&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:Conversely, suppose that &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; is disconnected with components &amp;lt;math&amp;gt;G_1 \uplus G_2 = G&amp;lt;/math&amp;gt;, we have &amp;lt;math&amp;gt;&lt;br /&gt;
A(G) = \begin{pmatrix}&lt;br /&gt;
A(G_1) &amp;amp; 0\\&lt;br /&gt;
0 &amp;amp; A(G_2)&lt;br /&gt;
\end{pmatrix}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Therefore, &amp;lt;math&amp;gt;A\vec{1}_{G_1}=d\vec{1}_{G_1}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;A\vec{1}_{G_2}=d\vec{1}_{G_2}&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;\vec{1}_{G_1}, \vec{1}_{G_2}&amp;lt;/math&amp;gt; are all-one vectors only supported  on &amp;lt;math&amp;gt;G_1, G_2&amp;lt;/math&amp;gt; respectively. Since &amp;lt;math&amp;gt;\vec{1}_{G_1}, \vec{1}_{G_2}&amp;lt;/math&amp;gt; are linearly independent, the multiplicity of eigenvalue &amp;lt;math&amp;gt;d&amp;lt;/math&amp;gt; is greater than 1, so &amp;lt;math&amp;gt;\lambda_1=\lambda_2&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Spectral Partitioning Algorithm ==&lt;br /&gt;
This is a popular heuristic in practice:&lt;br /&gt;
{{Theorem&lt;br /&gt;
|Spectral Partitioning Algorithm|&lt;br /&gt;
# Compute the second largest eigenvalue of the adjacency matrix and its corresponding eigenvector &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt;&lt;br /&gt;
# Sort the vertices &amp;lt;math&amp;gt; V=\{ u_1, \ldots, u_n\} &amp;lt;/math&amp;gt; so that &amp;lt;math&amp;gt; x(u_1) \ge x(u_2) \ge \ldots \ge x(u_n) &amp;lt;/math&amp;gt;&lt;br /&gt;
# Let &amp;lt;math&amp;gt; S_i:=\begin{cases}&lt;br /&gt;
\{1,2,\ldots,i\}, \qquad&amp;amp;\hbox{ if }i\le n/2 \\&lt;br /&gt;
V \setminus \{1,2,\ldots,i\}, &amp;amp;\hbox{ otherwise}&lt;br /&gt;
\end{cases} &amp;lt;/math&amp;gt;, and output &amp;lt;math&amp;gt; i = \arg\min_{1\le i \le n} \{ \varphi(S_i)\} &amp;lt;/math&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The performance guarantee of this algorithm comes from the Cheeger&#039;s inequality. In the worst-case, it only guarantees that the output set &amp;lt;math&amp;gt;S_i&amp;lt;/math&amp;gt; has conductance &amp;lt;math&amp;gt;\varphi(S_i) \le 2 \sqrt{\varphi(G)}&amp;lt;/math&amp;gt;. &lt;br /&gt;
In practice however, the performance is usually much better. We will discuss an improved Cheeger&#039;s inequality under additional assumptions on spectral gap later in class, which explains the effectiveness of the algorithm in practice.&lt;br /&gt;
&lt;br /&gt;
== Graph visualization ==&lt;br /&gt;
See slides.&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=%E9%AB%98%E7%BA%A7%E7%AE%97%E6%B3%95_(Fall_2024)/Min_Cut,_Max_Cut,_and_Spectral_Cut&amp;diff=12638</id>
		<title>高级算法 (Fall 2024)/Min Cut, Max Cut, and Spectral Cut</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=%E9%AB%98%E7%BA%A7%E7%AE%97%E6%B3%95_(Fall_2024)/Min_Cut,_Max_Cut,_and_Spectral_Cut&amp;diff=12638"/>
		<updated>2024-10-04T07:47:16Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: /* Graph Cut */  Remove the definition of graph cut via connectivity&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Graph Cut =&lt;br /&gt;
Let &amp;lt;math&amp;gt;G(V, E)&amp;lt;/math&amp;gt; be an undirected graph.&lt;br /&gt;
Let &amp;lt;math&amp;gt;\{S,T\}&amp;lt;/math&amp;gt; be a &#039;&#039;&#039;bipartition&#039;&#039;&#039; of &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; into nonempty subsets &amp;lt;math&amp;gt;S,T\subseteq V&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;S\cap T=\emptyset&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;S\cup T=V&amp;lt;/math&amp;gt;.  A cut &amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt; is specified by this bipartition as&lt;br /&gt;
:&amp;lt;math&amp;gt;C=E(S,T)\,&amp;lt;/math&amp;gt;,&lt;br /&gt;
where &amp;lt;math&amp;gt;E(S,T)&amp;lt;/math&amp;gt; denotes the set of &amp;quot;crossing edges&amp;quot; with one endpoint in each of &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, formally defined as&lt;br /&gt;
:&amp;lt;math&amp;gt;E(S,T)=\{uv\in E\mid u\in S, v\in T\}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Given a graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;, there might be many cuts in &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;, and we are interested in finding the &#039;&#039;&#039;minimum&#039;&#039;&#039; or &#039;&#039;&#039;maximum&#039;&#039;&#039; cut.&lt;br /&gt;
&lt;br /&gt;
= Min-Cut =&lt;br /&gt;
The &#039;&#039;&#039;min-cut problem&#039;&#039;&#039;, also called the &#039;&#039;&#039;global minimum cut problem&#039;&#039;&#039;, is defined as follows.&lt;br /&gt;
{{Theorem|Min-cut problem|&lt;br /&gt;
*&#039;&#039;&#039;Input&#039;&#039;&#039;: an undirected graph &amp;lt;math&amp;gt;G(V,E)&amp;lt;/math&amp;gt;;&lt;br /&gt;
*&#039;&#039;&#039;Output&#039;&#039;&#039;: a cut &amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt; in &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; with the smallest size &amp;lt;math&amp;gt;|C|&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Equivalently, the problem asks to find a bipartition of &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; into disjoint non-empty subsets &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; that minimizes &amp;lt;math&amp;gt;|E(S,T)|&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We consider the problem in a slightly more generalized setting, where the input graphs &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; can be &#039;&#039;&#039;multi-graphs&#039;&#039;&#039;, meaning that there could be multiple &#039;&#039;&#039;parallel edges&#039;&#039;&#039; between two vertices &amp;lt;math&amp;gt;u&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt;. The cuts in multi-graphs are defined in the same way as before, and the cost of a cut &amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt; is given by the total number of edges (including parallel edges) in &amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt;. Equivalently, one may think of a multi-graph as a graph with integer edge weights, and the cost of a cut &amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt; is the total weights of all edges in &amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
A canonical deterministic algorithm for this problem is through the [http://en.wikipedia.org/wiki/Max-flow_min-cut_theorem max-flow min-cut theorem]. The max-flow algorithm finds us a minimum &#039;&#039;&#039;&amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt;-&amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; cut&#039;&#039;&#039;, which disconnects a &#039;&#039;&#039;source&#039;&#039;&#039; &amp;lt;math&amp;gt;s\in V&amp;lt;/math&amp;gt; from a &#039;&#039;&#039;sink&#039;&#039;&#039; &amp;lt;math&amp;gt;t\in V&amp;lt;/math&amp;gt;, both specified as part of the input. A global min cut can be found by exhaustively finding the minimum &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt;-&amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; cut for an arbitrarily fixed source &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; and all possible sink &amp;lt;math&amp;gt;t\neq s&amp;lt;/math&amp;gt;. This takes &amp;lt;math&amp;gt;(n-1)\times&amp;lt;/math&amp;gt;max-flow time where &amp;lt;math&amp;gt;n=|V|&amp;lt;/math&amp;gt; is the number of vertices.&lt;br /&gt;
&lt;br /&gt;
The fastest known deterministic algorithm for the minimum cut problem on multi-graphs is the [https://en.wikipedia.org/wiki/Stoer–Wagner_algorithm Stoer–Wagner algorithm], which achieves an &amp;lt;math&amp;gt;O(mn+n^2\log n)&amp;lt;/math&amp;gt; time complexity where &amp;lt;math&amp;gt;m=|E|&amp;lt;/math&amp;gt; is the total number of edges (counting the parallel edges).&lt;br /&gt;
&lt;br /&gt;
If we restrict the input to be &#039;&#039;&#039;simple graphs&#039;&#039;&#039; (meaning there is no parallel edges) with no edge weight, there are better algorithms. A deterministic algorithm of [https://dl.acm.org/citation.cfm?id=2746588 Ken-ichi Kawarabayashi and Mikkel Thorup] published in STOC 2015, achieves the near-linear (in the number of edges) time complexity.&lt;br /&gt;
&lt;br /&gt;
== Karger&#039;s &#039;&#039;Contraction&#039;&#039; algorithm ==&lt;br /&gt;
We will describe a simple and elegant randomized algorithm for the min-cut problem. The algorithm is due to [http://people.csail.mit.edu/karger/ David Karger].&lt;br /&gt;
&lt;br /&gt;
Let &amp;lt;math&amp;gt;G(V, E)&amp;lt;/math&amp;gt; be a &#039;&#039;&#039;multi-graph&#039;&#039;&#039;, which allows more than one &#039;&#039;&#039;parallel edges&#039;&#039;&#039; between two distinct vertices &amp;lt;math&amp;gt;u&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; but does not allow any &#039;&#039;&#039;self-loops&#039;&#039;&#039;: the edges that adjoin a vertex to itself. A multi-graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; can be represented by an adjacency matrix &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt;, in the way that each non-diagonal entry &amp;lt;math&amp;gt;A(u,v)&amp;lt;/math&amp;gt; takes nonnegative integer values instead of just 0 or 1, representing the number of parallel edges between &amp;lt;math&amp;gt;u&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; in &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;, and all diagonal entries &amp;lt;math&amp;gt;A(v,v)=0&amp;lt;/math&amp;gt; (since there is no self-loop).&lt;br /&gt;
&lt;br /&gt;
Given a multi-graph &amp;lt;math&amp;gt;G(V,E)&amp;lt;/math&amp;gt; and an edge &amp;lt;math&amp;gt;e\in E&amp;lt;/math&amp;gt;, we define the following &#039;&#039;&#039;contraction&#039;&#039;&#039; operator Contract(&amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;e&amp;lt;/math&amp;gt;), which transform &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; to a new multi-graph.&lt;br /&gt;
{{Theorem|The contraction operator &#039;&#039;Contract&#039;&#039;(&amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;e&amp;lt;/math&amp;gt;)|&lt;br /&gt;
:say &amp;lt;math&amp;gt;e=uv&amp;lt;/math&amp;gt;:&lt;br /&gt;
:*replace &amp;lt;math&amp;gt;\{u,v\}&amp;lt;/math&amp;gt; by a new vertex &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt;;&lt;br /&gt;
:*for every edge (no matter parallel or not) in the form of &amp;lt;math&amp;gt;uw&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;vw&amp;lt;/math&amp;gt; that connects one of &amp;lt;math&amp;gt;\{u,v\}&amp;lt;/math&amp;gt; to a vertex &amp;lt;math&amp;gt;w\in V\setminus\{u,v\}&amp;lt;/math&amp;gt; in the graph other than &amp;lt;math&amp;gt;u,v&amp;lt;/math&amp;gt;, replace it by a new edge &amp;lt;math&amp;gt;xw&amp;lt;/math&amp;gt;;&lt;br /&gt;
:*the reset of the graph does not change.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
In other words, the &amp;lt;math&amp;gt;Contract(G,uv)&amp;lt;/math&amp;gt; merges the two vertices &amp;lt;math&amp;gt;u&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; into a new vertex &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; whose incident edges preserves the edges incident to &amp;lt;math&amp;gt;u&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; in the original graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; except for the parallel edges between them. Now you should realize why we consider multi-graphs instead of simple graphs, because even if we start with a simple graph without parallel edges, the contraction operator may create parallel edges.&lt;br /&gt;
&lt;br /&gt;
The contraction operator is illustrated by the following picture:&lt;br /&gt;
[[Image:Contract.png|600px|center]]&lt;br /&gt;
&lt;br /&gt;
Karger&#039;s algorithm uses a simple idea: &lt;br /&gt;
*At each step we randomly select an edge in the current multi-graph to contract until there are only two vertices left. &lt;br /&gt;
*The parallel edges between these two remaining vertices must be a cut of the original graph. &lt;br /&gt;
*We return this cut and hope that with good chance this gives us a minimum cut.&lt;br /&gt;
The following is the pseudocode for Karger&#039;s algorithm.&lt;br /&gt;
{{Theorem|&#039;&#039;RandomContract&#039;&#039; (Karger 1993)|&lt;br /&gt;
:&#039;&#039;&#039;Input:&#039;&#039;&#039; multi-graph &amp;lt;math&amp;gt;G(V,E)&amp;lt;/math&amp;gt;;&lt;br /&gt;
----&lt;br /&gt;
:while &amp;lt;math&amp;gt;|V|&amp;gt;2&amp;lt;/math&amp;gt; do&lt;br /&gt;
:* choose an edge &amp;lt;math&amp;gt;uv\in E&amp;lt;/math&amp;gt; uniformly at random;&lt;br /&gt;
:* &amp;lt;math&amp;gt;G=Contract(G,uv)&amp;lt;/math&amp;gt;; &lt;br /&gt;
:return &amp;lt;math&amp;gt;C=E&amp;lt;/math&amp;gt; (the parallel edges between the only two vertices in &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt;);&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Another way of looking at the contraction operator Contract(&amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;e&amp;lt;/math&amp;gt;) is that we are dealing with classes of vertices. Let &amp;lt;math&amp;gt;V=\{v_1,v_2,\ldots,v_n\}&amp;lt;/math&amp;gt; be the set of all vertices. We start with &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; vertex classes &amp;lt;math&amp;gt;S_1,S_2,\ldots, S_n&amp;lt;/math&amp;gt; with each class &amp;lt;math&amp;gt;S_i=\{v_i\}&amp;lt;/math&amp;gt; contains one vertex. By calling &amp;lt;math&amp;gt;Contract(G,uv)&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;u\in S_i&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v\in S_j&amp;lt;/math&amp;gt; for distinct &amp;lt;math&amp;gt;i\neq j&amp;lt;/math&amp;gt;, we take union of &amp;lt;math&amp;gt;S_i&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;S_j&amp;lt;/math&amp;gt;. The edges in the contracted multi-graph are the edges that cross between different vertex classes.&lt;br /&gt;
&lt;br /&gt;
This view of contraction is illustrated by the following picture:&lt;br /&gt;
[[Image:Contract_class.png|600px|center]]&lt;br /&gt;
&lt;br /&gt;
The following claim is left as an exercise for the class:&lt;br /&gt;
:{|border=&amp;quot;2&amp;quot; width=&amp;quot;100%&amp;quot; cellspacing=&amp;quot;4&amp;quot; cellpadding=&amp;quot;3&amp;quot; rules=&amp;quot;all&amp;quot; style=&amp;quot;margin:1em 1em 1em 0; border:solid 1px #AAAAAA; border-collapse:collapse;empty-cells:show;&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
*With suitable choice of data structures, each operation &amp;lt;math&amp;gt;Contract(G,e)&amp;lt;/math&amp;gt; can be implemented within running time &amp;lt;math&amp;gt;O(n)&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;n=|V|&amp;lt;/math&amp;gt; is the number of vertices.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In the above &#039;&#039;&#039;&#039;&#039;RandomContract&#039;&#039;&#039;&#039;&#039; algorithm, there are precisely &amp;lt;math&amp;gt;n-2&amp;lt;/math&amp;gt; contractions. Therefore, we have the following time upper bound.&lt;br /&gt;
{{Theorem|Theorem|&lt;br /&gt;
: For any multigraph with &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; vertices, the running time of the &#039;&#039;&#039;&#039;&#039;RandomContract&#039;&#039;&#039;&#039;&#039; algorithm is &amp;lt;math&amp;gt;O(n^2)&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
We emphasize that it&#039;s the time complexity of a &amp;quot;single running&amp;quot; of the algorithm: later we will see we may need to run this algorithm for many times to guarantee a desirable accuracy.&lt;br /&gt;
&lt;br /&gt;
== Analysis of accuracy ==&lt;br /&gt;
We now analyze the performance of the above algorithm. Since the algorithm is &#039;&#039;&#039;&#039;&#039;randomized&#039;&#039;&#039;&#039;&#039;, its output cut is a random variable even when the input is fixed, so &#039;&#039;the output may not always be correct&#039;&#039;. We want to give a theoretical guarantee of the chance that the algorithm returns a correct answer on an arbitrary input.&lt;br /&gt;
&lt;br /&gt;
More precisely, on an arbitrarily fixed input multi-graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;, we want to answer the following question rigorously:&lt;br /&gt;
:&amp;lt;math&amp;gt;p_{\text{correct}}=\Pr[\,\text{a minimum cut is returned by }RandomContract\,]\ge ?&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To answer this question, we prove a stronger statement: for arbitrarily fixed input multi-graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; and a particular minimum cut &amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt; in &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;, &lt;br /&gt;
:&amp;lt;math&amp;gt;p_{C}=\Pr[\,C\mbox{ is returned by }RandomContract\,]\ge ?&amp;lt;/math&amp;gt;&lt;br /&gt;
Obviously this will imply the previous lower bound for &amp;lt;math&amp;gt;p_{\text{correct}}&amp;lt;/math&amp;gt; because the event in &amp;lt;math&amp;gt;p_{C}&amp;lt;/math&amp;gt; implies the event in &amp;lt;math&amp;gt;p_{\text{correct}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
:{|border=&amp;quot;2&amp;quot; width=&amp;quot;100%&amp;quot; cellspacing=&amp;quot;4&amp;quot; cellpadding=&amp;quot;3&amp;quot; rules=&amp;quot;all&amp;quot; style=&amp;quot;margin:1em 1em 1em 0; border:solid 1px #AAAAAA; border-collapse:collapse;empty-cells:show;&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
*In above argument we use the simple law in probability that &amp;lt;math&amp;gt;\Pr[A]\le \Pr[B]&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt;A\subseteq B&amp;lt;/math&amp;gt;, i.e. event &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; implies event &amp;lt;math&amp;gt;B&amp;lt;/math&amp;gt;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We introduce the following notations:&lt;br /&gt;
*Let &amp;lt;math&amp;gt;e_1,e_2,\ldots,e_{n-2}&amp;lt;/math&amp;gt; denote the sequence of random edges chosen to contract in a running of &#039;&#039;RandomContract&#039;&#039; algorithm. &lt;br /&gt;
*Let &amp;lt;math&amp;gt;G_1=G&amp;lt;/math&amp;gt; denote the original input multi-graph. And for &amp;lt;math&amp;gt;i=1,2,\ldots,n-2&amp;lt;/math&amp;gt;, let &amp;lt;math&amp;gt;G_{i+1}=Contract(G_{i},e_i)&amp;lt;/math&amp;gt; be the multigraph after &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;th contraction.&lt;br /&gt;
Obviously &amp;lt;math&amp;gt;e_1,e_2,\ldots,e_{n-2}&amp;lt;/math&amp;gt; are random variables, and they are the &#039;&#039;only&#039;&#039; random choices used in the algorithm: meaning that they along with the input &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;, uniquely determine the sequence of multi-graphs &amp;lt;math&amp;gt;G_1,G_2,\ldots,G_{n-2}&amp;lt;/math&amp;gt; in every iteration as well as the final output. &lt;br /&gt;
&lt;br /&gt;
We now compute the probability &amp;lt;math&amp;gt;p_C&amp;lt;/math&amp;gt; by decompose it into more elementary events involving &amp;lt;math&amp;gt;e_1,e_2,\ldots,e_{n-2}&amp;lt;/math&amp;gt;. This is due to the following proposition.&lt;br /&gt;
{{Theorem&lt;br /&gt;
|Proposition 1|&lt;br /&gt;
:If &amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt; is a minimum cut in a multi-graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;e\not\in C&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt; is still a minimum cut in the contracted graph &amp;lt;math&amp;gt;G&#039;=contract(G,e)&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
{{Proof|&lt;br /&gt;
We first observe that contraction will never create new cuts: every cut in the contracted graph &amp;lt;math&amp;gt;G&#039;&amp;lt;/math&amp;gt; must also be a cut in the original graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We then observe that a cut &amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt; in &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; &amp;quot;survives&amp;quot; in the contracted graph &amp;lt;math&amp;gt;G&#039;&amp;lt;/math&amp;gt; if and only if the contracted edge &amp;lt;math&amp;gt;e\not\in C&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Both observations are easy to verify by the definition of contraction operator (in particular, easier to verify if we take the vertex class interpretation). The detailed proofs are left as an exercise.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Recall that &amp;lt;math&amp;gt;e_1,e_2,\ldots,e_{n-2}&amp;lt;/math&amp;gt; denote the sequence of random edges chosen to contract in a running of &#039;&#039;RandomContract&#039;&#039; algorithm.&lt;br /&gt;
&lt;br /&gt;
By Proposition 1, the event &amp;lt;math&amp;gt;\mbox{``}C\mbox{ is returned by }RandomContract\mbox{&#039;&#039;}\,&amp;lt;/math&amp;gt; is equivalent to the event &amp;lt;math&amp;gt;\mbox{``}e_i\not\in C\mbox{ for all }i=1,2,\ldots,n-2\mbox{&#039;&#039;}&amp;lt;/math&amp;gt;. Therefore:&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{align}&lt;br /&gt;
p_C &lt;br /&gt;
&amp;amp;=&lt;br /&gt;
\Pr[\,C\mbox{ is returned by }{RandomContract}\,]\\&lt;br /&gt;
&amp;amp;=&lt;br /&gt;
\Pr[\,e_i\not\in C\mbox{ for all }i=1,2,\ldots,n-2\,]\\&lt;br /&gt;
&amp;amp;=&lt;br /&gt;
\prod_{i=1}^{n-2}\Pr[e_i\not\in C\mid \forall j&amp;lt;i, e_j\not\in C].&lt;br /&gt;
\end{align}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
The last equation is due to the so called &#039;&#039;&#039;chain rule&#039;&#039;&#039; in probability.&lt;br /&gt;
:{|border=&amp;quot;2&amp;quot; width=&amp;quot;100%&amp;quot; cellspacing=&amp;quot;4&amp;quot; cellpadding=&amp;quot;3&amp;quot; rules=&amp;quot;all&amp;quot; style=&amp;quot;margin:1em 1em 1em 0; border:solid 1px #AAAAAA; border-collapse:collapse;empty-cells:show;&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
*The &#039;&#039;&#039;chain rule&#039;&#039;&#039;, also known as the &#039;&#039;&#039;law of progressive conditioning&#039;&#039;&#039;, is the following proposition: for a sequence of events (not necessarily independent) &amp;lt;math&amp;gt;A_1,A_2,\ldots,A_n&amp;lt;/math&amp;gt;,&lt;br /&gt;
::&amp;lt;math&amp;gt;\Pr[\forall i, A_i]=\prod_{i=1}^n\Pr[A_i\mid \forall j&amp;lt;i, A_j]&amp;lt;/math&amp;gt;.&lt;br /&gt;
:It is a simple consequence of the definition of conditional probability. By definition of conditional probability, &lt;br /&gt;
::&amp;lt;math&amp;gt;\Pr[A_n\mid \forall j&amp;lt;n]=\frac{\Pr[\forall i, A_i]}{\Pr[\forall j&amp;lt;n, A_j]}&amp;lt;/math&amp;gt;, &lt;br /&gt;
:and equivalently we have&lt;br /&gt;
::&amp;lt;math&amp;gt;\Pr[\forall i, A_i]=\Pr[\forall j&amp;lt;n, A_j]\Pr[A_n\mid \forall j&amp;lt;n]&amp;lt;/math&amp;gt;.&lt;br /&gt;
:Recursively apply this to &amp;lt;math&amp;gt;\Pr[\forall j&amp;lt;n, A_j]&amp;lt;/math&amp;gt; we obtain the chain rule.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Back to the analysis of probability &amp;lt;math&amp;gt;p_C&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Now our task is to give lower bound to each &amp;lt;math&amp;gt;p_i=\Pr[e_i\not\in C\mid \forall j&amp;lt;i, e_j\not\in C]&amp;lt;/math&amp;gt;. The condition &amp;lt;math&amp;gt;\mbox{``}\forall j&amp;lt;i, e_j\not\in C\mbox{&#039;&#039;}&amp;lt;/math&amp;gt; means the min-cut &amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt; survives all first &amp;lt;math&amp;gt;i-1&amp;lt;/math&amp;gt; contractions &amp;lt;math&amp;gt;e_1,e_2,\ldots,e_{i-1}&amp;lt;/math&amp;gt;, which due to Proposition 1 means that &amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt; is also a min-cut in the multi-graph &amp;lt;math&amp;gt;G_i&amp;lt;/math&amp;gt; obtained from applying the first &amp;lt;math&amp;gt;(i-1)&amp;lt;/math&amp;gt; contractions.&lt;br /&gt;
&lt;br /&gt;
Then the conditional probability &amp;lt;math&amp;gt;p_i=\Pr[e_i\not\in C\mid \forall j&amp;lt;i, e_j\not\in C]&amp;lt;/math&amp;gt; is the probability that no edge in &amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt; is hit when a uniform random edge in the current multi-graph is chosen assuming that &amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt; is a minimum cut in the current multi-graph. Intuitively this probability should be bounded from below, because as a min-cut &amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt; should be sparse among all edges. This intuition is justified by the following proposition.&lt;br /&gt;
&lt;br /&gt;
{{Theorem&lt;br /&gt;
|Proposition 2|&lt;br /&gt;
:If &amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt; is a min-cut in a multi-graph &amp;lt;math&amp;gt;G(V,E)&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;|E|\ge \frac{|V||C|}{2}&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
{{Proof| &lt;br /&gt;
:It must hold that the degree of each vertex &amp;lt;math&amp;gt;v\in V&amp;lt;/math&amp;gt; is at least &amp;lt;math&amp;gt;|C|&amp;lt;/math&amp;gt;, or otherwise the set of edges incident to &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; forms a cut of size smaller than &amp;lt;math&amp;gt;|C|&amp;lt;/math&amp;gt; which separates &amp;lt;math&amp;gt;\{v\}&amp;lt;/math&amp;gt; from the rest of the graph, contradicting that &amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt; is a min-cut. And the bound &amp;lt;math&amp;gt;|E|\ge \frac{|V||C|}{2}&amp;lt;/math&amp;gt; follows directly from applying the [https://en.wikipedia.org/wiki/Handshaking_lemma handshaking lemma] to the fact that every vertex in &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; has degree at least &amp;lt;math&amp;gt;|C|&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Let &amp;lt;math&amp;gt;V_i&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_i&amp;lt;/math&amp;gt; denote the vertex set and edge set of the multi-graph &amp;lt;math&amp;gt;G_i&amp;lt;/math&amp;gt; respectively, and recall that &amp;lt;math&amp;gt;G_i&amp;lt;/math&amp;gt; is the multi-graph obtained from applying first &amp;lt;math&amp;gt;(i-1)&amp;lt;/math&amp;gt; contractions. Obviously &amp;lt;math&amp;gt;|V_{i}|=n-i+1&amp;lt;/math&amp;gt;. And due to Proposition 2, &amp;lt;math&amp;gt;|E_i|\ge \frac{|V_i||C|}{2}&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt; is still a min-cut in &amp;lt;math&amp;gt;G_i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The probability &amp;lt;math&amp;gt;p_i=\Pr[e_i\not\in C\mid \forall j&amp;lt;i, e_j\not\in C]&amp;lt;/math&amp;gt; can be computed as&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{align}&lt;br /&gt;
p_i&lt;br /&gt;
&amp;amp;=1-\frac{|C|}{|E_i|}\\&lt;br /&gt;
&amp;amp;\ge1-\frac{2}{|V_i|}\\&lt;br /&gt;
&amp;amp;=1-\frac{2}{n-i+1}&lt;br /&gt;
\end{align},&amp;lt;/math&amp;gt;&lt;br /&gt;
where the inequality is due to Proposition 2. &lt;br /&gt;
&lt;br /&gt;
We now can put everything together. We arbitrarily fix the input multi-graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; and any particular minimum cut &amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt; in &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;. &lt;br /&gt;
:&amp;lt;math&amp;gt;\begin{align}&lt;br /&gt;
p_{\text{correct}}&lt;br /&gt;
&amp;amp;=\Pr[\,\text{a minimum cut is returned by }RandomContract\,]\\&lt;br /&gt;
&amp;amp;\ge&lt;br /&gt;
\Pr[\,C\mbox{ is returned by }{RandomContract}\,]\\&lt;br /&gt;
&amp;amp;=&lt;br /&gt;
\Pr[\,e_i\not\in C\mbox{ for all }i=1,2,\ldots,n-2\,]\\&lt;br /&gt;
&amp;amp;=&lt;br /&gt;
\prod_{i=1}^{n-2}\Pr[e_i\not\in C\mid \forall j&amp;lt;i, e_j\not\in C]\\&lt;br /&gt;
&amp;amp;\ge&lt;br /&gt;
\prod_{i=1}^{n-2}\left(1-\frac{2}{n-i+1}\right)\\&lt;br /&gt;
&amp;amp;=&lt;br /&gt;
\prod_{k=3}^{n}\frac{k-2}{k}\\&lt;br /&gt;
&amp;amp;= \frac{2}{n(n-1)}.&lt;br /&gt;
\end{align}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This gives us the following theorem.&lt;br /&gt;
{{Theorem&lt;br /&gt;
|Theorem|&lt;br /&gt;
: For any multigraph with &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; vertices, the &#039;&#039;RandomContract&#039;&#039; algorithm returns a minimum cut with probability at least &amp;lt;math&amp;gt;\frac{2}{n(n-1)}&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
At first glance this seems to be a miserable chance of success. However, notice that there may be exponential many cuts in a graph (because potentially every nonempty subset &amp;lt;math&amp;gt;S\subset V&amp;lt;/math&amp;gt; corresponds to a cut &amp;lt;math&amp;gt;C=E(S,\overline{S})&amp;lt;/math&amp;gt;), and Karger&#039;s algorithm effectively reduce this exponential-sized space of feasible solutions to a quadratic size one, an exponential improvement!&lt;br /&gt;
&lt;br /&gt;
We can run &#039;&#039;RandomContract&#039;&#039; independently for &amp;lt;math&amp;gt;t=\frac{n(n-1)\ln n}{2}&amp;lt;/math&amp;gt; times and return the smallest cut ever returned. The probability that a minimum cut is found is at least:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\begin{align}&lt;br /&gt;
&amp;amp;\quad 1-\Pr[\,\mbox{all }t\mbox{ independent runnings of } RandomContract\mbox{ fails to find a min-cut}\,] \\&lt;br /&gt;
&amp;amp;= 1-\Pr[\,\mbox{a single running of }{RandomContract}\mbox{ fails}\,]^{t} \\&lt;br /&gt;
&amp;amp;\ge 1- \left(1-\frac{2}{n(n-1)}\right)^{\frac{n(n-1)\ln n}{2}} \\&lt;br /&gt;
&amp;amp;\ge 1-\frac{1}{n}.&lt;br /&gt;
\end{align}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Recall that a running of &#039;&#039;RandomContract&#039;&#039; algorithm takes &amp;lt;math&amp;gt;O(n^2)&amp;lt;/math&amp;gt; time. Altogether this gives us a randomized algorithm running in time &amp;lt;math&amp;gt;O(n^4\log n)&amp;lt;/math&amp;gt; and find a minimum cut [https://en.wikipedia.org/wiki/With_high_probability &#039;&#039;&#039;with high probability&#039;&#039;&#039;].&lt;br /&gt;
&lt;br /&gt;
== A Corollary by the Probabilistic Method ==&lt;br /&gt;
The analysis of Karger&#039;s algorithm implies the following combinatorial proposition for the number of distinct minimum cuts in a graph.&lt;br /&gt;
{{Theorem|Corollary|&lt;br /&gt;
:For any graph &amp;lt;math&amp;gt;G(V,E)&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; vertices, the number of distinct minimum cuts in &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; is at most &amp;lt;math&amp;gt;\frac{n(n-1)}{2}&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
{{Proof|&lt;br /&gt;
Let &amp;lt;math&amp;gt;\mathcal{C}&amp;lt;/math&amp;gt; denote the set of all minimum cuts in &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;. For each min-cut &amp;lt;math&amp;gt;C\in\mathcal{C}&amp;lt;/math&amp;gt;, let &amp;lt;math&amp;gt;A_C&amp;lt;/math&amp;gt; denote the event &amp;quot;&amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt; is returned by &#039;&#039;RandomContract&#039;&#039;&amp;quot;, whose probability is given by &lt;br /&gt;
:&amp;lt;math&amp;gt;p_C=\Pr[A_C]\,&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Clearly we have:&lt;br /&gt;
* for any distinct &amp;lt;math&amp;gt;C,D\in\mathcal{C}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;A_C\,&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;A_{D}\,&amp;lt;/math&amp;gt; are &#039;&#039;&#039;disjoint events&#039;&#039;&#039;; and&lt;br /&gt;
* the union &amp;lt;math&amp;gt;\bigcup_{C\in\mathcal{C}}A_C&amp;lt;/math&amp;gt; is precisely the event &amp;quot;a minimum cut is returned by &#039;&#039;RandomContract&#039;&#039;&amp;quot;, whose probability is given by&lt;br /&gt;
::&amp;lt;math&amp;gt;p_{\text{correct}}=\Pr[\,\text{a minimum cut is returned by } RandomContract\,]&amp;lt;/math&amp;gt;.&lt;br /&gt;
Due to the [https://en.wikipedia.org/wiki/Probability_axioms#Third_axiom &#039;&#039;&#039;additivity of probability&#039;&#039;&#039;], it holds that&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
p_{\text{correct}}=\sum_{C\in\mathcal{C}}\Pr[A_C]=\sum_{C\in\mathcal{C}}p_C.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By the analysis of Karger&#039;s algorithm, we know &amp;lt;math&amp;gt;p_C\ge\frac{2}{n(n-1)}&amp;lt;/math&amp;gt;. And since &amp;lt;math&amp;gt;p_{\text{correct}}&amp;lt;/math&amp;gt; is a well defined probability, due to the [https://en.wikipedia.org/wiki/Probability_axioms#Second_axiom &#039;&#039;&#039;unitarity of probability&#039;&#039;&#039;], it must hold that &amp;lt;math&amp;gt;p_{\text{correct}}\le 1&amp;lt;/math&amp;gt;. Therefore,&lt;br /&gt;
:&amp;lt;math&amp;gt;1\ge p_{\text{correct}}=\sum_{C\in\mathcal{C}}p_C\ge|\mathcal{C}|\frac{2}{n(n-1)}&amp;lt;/math&amp;gt;,&lt;br /&gt;
which means &amp;lt;math&amp;gt;|\mathcal{C}|\le\frac{n(n-1)}{2}&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Note that the statement of this theorem has no randomness at all, while the proof consists of a randomized procedure. This is an example of [http://en.wikipedia.org/wiki/Probabilistic_method the probabilistic method].&lt;br /&gt;
&lt;br /&gt;
== Fast Min-Cut ==&lt;br /&gt;
In the analysis of &#039;&#039;RandomContract&#039;&#039; algorithm, recall that we lower bound the probability &amp;lt;math&amp;gt;p_C&amp;lt;/math&amp;gt; that a min-cut &amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt; is returned by &#039;&#039;RandomContract&#039;&#039; by the following &#039;&#039;&#039;telescopic product&#039;&#039;&#039;:&lt;br /&gt;
:&amp;lt;math&amp;gt;p_C\ge\prod_{i=1}^{n-2}\left(1-\frac{2}{n-i+1}\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
Here the index &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; corresponds to the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;th contraction. The factor &amp;lt;math&amp;gt;\left(1-\frac{2}{n-i+1}\right)&amp;lt;/math&amp;gt; is decreasing in &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;, which means:&lt;br /&gt;
* The probability of success is only getting bad when the graph is getting &amp;quot;too contracted&amp;quot;, that is, when the number of remaining vertices is getting small. &lt;br /&gt;
This motivates us to consider the following alternation to the algorithm: first using random contractions to reduce the number of vertices to a moderately small number, and then recursively finding a min-cut in this smaller instance. This seems just a restatement of exactly what we have been doing. Inspired by the idea of boosting the accuracy via independent repetition, here we apply the recursion on &#039;&#039;two&#039;&#039; smaller instances generated independently.&lt;br /&gt;
&lt;br /&gt;
The algorithm obtained in this way is called &#039;&#039;FastCut&#039;&#039;. We first define a procedure to randomly contract edges until there are &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; number of vertices left.&lt;br /&gt;
&lt;br /&gt;
{{Theorem|&#039;&#039;RandomContract&#039;&#039;&amp;lt;math&amp;gt;(G, t)&amp;lt;/math&amp;gt;|&lt;br /&gt;
:&#039;&#039;&#039;Input:&#039;&#039;&#039; multi-graph &amp;lt;math&amp;gt;G(V,E)&amp;lt;/math&amp;gt;, and integer &amp;lt;math&amp;gt;t\ge 2&amp;lt;/math&amp;gt;;&lt;br /&gt;
----&lt;br /&gt;
:while &amp;lt;math&amp;gt;|V|&amp;gt;t&amp;lt;/math&amp;gt; do&lt;br /&gt;
:* choose an edge &amp;lt;math&amp;gt;uv\in E&amp;lt;/math&amp;gt; uniformly at random;&lt;br /&gt;
:* &amp;lt;math&amp;gt;G=Contract(G,uv)&amp;lt;/math&amp;gt;; &lt;br /&gt;
:return &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;FastCut&#039;&#039; algorithm is recursively defined as follows.&lt;br /&gt;
{{Theorem|&#039;&#039;FastCut&#039;&#039;&amp;lt;math&amp;gt;(G)&amp;lt;/math&amp;gt;|&lt;br /&gt;
:&#039;&#039;&#039;Input:&#039;&#039;&#039; multi-graph &amp;lt;math&amp;gt;G(V,E)&amp;lt;/math&amp;gt;;&lt;br /&gt;
----&lt;br /&gt;
:if &amp;lt;math&amp;gt;|V|\le 6&amp;lt;/math&amp;gt; then return a mincut by brute force;&lt;br /&gt;
:else let &amp;lt;math&amp;gt;t=\left\lceil1+|V|/\sqrt{2}\right\rceil&amp;lt;/math&amp;gt;;&lt;br /&gt;
:: &amp;lt;math&amp;gt;G_1=RandomContract(G,t)&amp;lt;/math&amp;gt;;&lt;br /&gt;
:: &amp;lt;math&amp;gt;G_2=RandomContract(G,t)&amp;lt;/math&amp;gt;; &lt;br /&gt;
::return the smaller one of &amp;lt;math&amp;gt;FastCut(G_1)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;FastCut(G_2)&amp;lt;/math&amp;gt;;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
As before, all &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; are multigraphs.&lt;br /&gt;
&lt;br /&gt;
Fix a min-cut &amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt; in the original multigraph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;. By the same analysis as in the case of &#039;&#039;RandomContract&#039;&#039;, we have&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{align}&lt;br /&gt;
&amp;amp;\Pr[C\text{ survives all contractions in }RandomContract(G,t)]\\&lt;br /&gt;
=&lt;br /&gt;
&amp;amp;\prod_{i=1}^{n-t}\Pr[C\text{ survives the }i\text{-th contraction}\mid C\text{ survives the first }(i-1)\text{-th contractions}]\\&lt;br /&gt;
\ge&lt;br /&gt;
&amp;amp;\prod_{i=1}^{n-t}\left(1-\frac{2}{n-i+1}\right)\\&lt;br /&gt;
=&lt;br /&gt;
&amp;amp;\prod_{k=t+1}^{n}\frac{k-2}{k}\\&lt;br /&gt;
=&lt;br /&gt;
&amp;amp;\frac{t(t-1)}{n(n-1)}.&lt;br /&gt;
\end{align}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
When &amp;lt;math&amp;gt;t=\left\lceil1+n/\sqrt{2}\right\rceil&amp;lt;/math&amp;gt;, this probability is at least &amp;lt;math&amp;gt;1/2&amp;lt;/math&amp;gt;. The choice of &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; is due to our purpose to make this probability at least &amp;lt;math&amp;gt;1/2&amp;lt;/math&amp;gt;. You will see this is crucial in the following analysis of accuracy.&lt;br /&gt;
&lt;br /&gt;
We denote by &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;B&amp;lt;/math&amp;gt; the following events:&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{align}&lt;br /&gt;
A:&lt;br /&gt;
&amp;amp;\quad C\text{  survives all contractions in }RandomContract(G,t);\\&lt;br /&gt;
B:&lt;br /&gt;
&amp;amp;\quad\text{size of min-cut is unchanged after }RandomContract(G,t);&lt;br /&gt;
\end{align}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
Clearly, &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; implies &amp;lt;math&amp;gt;B&amp;lt;/math&amp;gt; and by above analysis &amp;lt;math&amp;gt;\Pr[B]\ge\Pr[A]\ge\frac{1}{2}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We denote by &amp;lt;math&amp;gt;p(n)&amp;lt;/math&amp;gt; the lower bound on the probability that &amp;lt;math&amp;gt;FastCut(G)&amp;lt;/math&amp;gt; succeeds for a multigraph of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; vertices, that is&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
p(n)&lt;br /&gt;
=\min_{G: |V|=n}\Pr[\,FastCut(G)\text{ returns a min-cut in }G\,].&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
Suppose that &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; is the multigraph that achieves the minimum in above definition. The following recurrence holds for &amp;lt;math&amp;gt;p(n)&amp;lt;/math&amp;gt;.&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{align}&lt;br /&gt;
p(n)&lt;br /&gt;
&amp;amp;=&lt;br /&gt;
\Pr[\,FastCut(G)\text{ returns a min-cut in }G\,]\\&lt;br /&gt;
&amp;amp;=&lt;br /&gt;
\Pr[\,\text{ a min-cut of }G\text{ is returned by }FastCut(G_1)\text{ or }FastCut(G_2)\,]\\&lt;br /&gt;
&amp;amp;\ge&lt;br /&gt;
1-\left(1-\Pr[B\wedge FastCut(G_1)\text{ returns a min-cut in }G_1\,]\right)^2\\&lt;br /&gt;
&amp;amp;\ge&lt;br /&gt;
1-\left(1-\Pr[A\wedge FastCut(G_1)\text{ returns a min-cut in }G_1\,]\right)^2\\&lt;br /&gt;
&amp;amp;=&lt;br /&gt;
1-\left(1-\Pr[A]\Pr[ FastCut(G_1)\text{ returns a min-cut in }G_1\mid A]\right)^2\\&lt;br /&gt;
&amp;amp;\ge&lt;br /&gt;
1-\left(1-\frac{1}{2}p\left(\left\lceil1+n/\sqrt{2}\right\rceil\right)\right)^2,&lt;br /&gt;
\end{align}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;B&amp;lt;/math&amp;gt; are defined as above such that &amp;lt;math&amp;gt;\Pr[A]\ge\frac{1}{2}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The base case is that  &amp;lt;math&amp;gt;p(n)=1&amp;lt;/math&amp;gt; for &amp;lt;math&amp;gt;n\le 6&amp;lt;/math&amp;gt;. By induction it is easy to prove that&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
p(n)=\Omega\left(\frac{1}{\log n}\right).&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Recall that we can implement an edge contraction in &amp;lt;math&amp;gt;O(n)&amp;lt;/math&amp;gt; time, thus it is easy to verify the following recursion of time complexity:&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
T(n)=2T\left(\left\lceil1+n/\sqrt{2}\right\rceil\right)+O(n^2),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math&amp;gt;T(n)&amp;lt;/math&amp;gt; denotes the running time of &amp;lt;math&amp;gt;FastCut(G)&amp;lt;/math&amp;gt; on a multigraph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; vertices.&lt;br /&gt;
&lt;br /&gt;
By induction with the base case &amp;lt;math&amp;gt;T(n)=O(1)&amp;lt;/math&amp;gt; for &amp;lt;math&amp;gt;n\le 6&amp;lt;/math&amp;gt;, it is easy to verify that &amp;lt;math&amp;gt;T(n)=O(n^2\log n)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{{Theorem&lt;br /&gt;
|Theorem|&lt;br /&gt;
: For any multigraph with &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; vertices, the &#039;&#039;FastCut&#039;&#039; algorithm returns a minimum cut with probability &amp;lt;math&amp;gt;\Omega\left(\frac{1}{\log n}\right)&amp;lt;/math&amp;gt; in time &amp;lt;math&amp;gt;O(n^2\log n)&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
At this point, we see the name &#039;&#039;FastCut&#039;&#039; is misleading because it is actually slower than the original &#039;&#039;RandomContract&#039;&#039; algorithm, only the chance of successfully finding a min-cut is much better (improved from an &amp;lt;math&amp;gt;\Omega(1/n^2)&amp;lt;/math&amp;gt; to an &amp;lt;math&amp;gt;\Omega(1/\log n)&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
Given any input multi-graph, repeatedly running the &#039;&#039;FastCut&#039;&#039; algorithm independently for some &amp;lt;math&amp;gt;O((\log n)^2)&amp;lt;/math&amp;gt; times and returns the smallest cut ever returned, we have an algorithm which runs in time &amp;lt;math&amp;gt;O(n^2\log^3n)&amp;lt;/math&amp;gt; and returns a min-cut with probability &amp;lt;math&amp;gt;1-O(1/n)&amp;lt;/math&amp;gt;, i.e. with high probability.&lt;br /&gt;
&lt;br /&gt;
Recall that the running time of best known deterministic algorithm for min-cut on multi-graph is &amp;lt;math&amp;gt;O(mn+n^2\log n)&amp;lt;/math&amp;gt;. On dense graph, the randomized algorithm outperforms the best known deterministic algorithm.&lt;br /&gt;
&lt;br /&gt;
Finally, Karger further improves this and obtains a near-linear (in the number of edges) time [https://arxiv.org/abs/cs/9812007 randomized algorithm] for minimum cut in multi-graphs.&lt;br /&gt;
&lt;br /&gt;
= Max-Cut=&lt;br /&gt;
The &#039;&#039;&#039;maximum cut problem&#039;&#039;&#039;, in short the &#039;&#039;&#039;max-cut problem&#039;&#039;&#039;, is defined as follows.&lt;br /&gt;
{{Theorem|Max-cut problem|&lt;br /&gt;
*&#039;&#039;&#039;Input&#039;&#039;&#039;: an undirected graph &amp;lt;math&amp;gt;G(V,E)&amp;lt;/math&amp;gt;;&lt;br /&gt;
*&#039;&#039;&#039;Output&#039;&#039;&#039;: a bipartition of &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; into disjoint subsets &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; that maximizes &amp;lt;math&amp;gt;|E(S,T)|&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The problem is a typical MAX-CSP, an optimization version of the [https://en.wikipedia.org/wiki/Constraint_satisfaction_problem constraint satisfaction problem]. An instance of CSP consists of:&lt;br /&gt;
* a set of variables &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_n&amp;lt;/math&amp;gt; usually taking values from some finite domain;&lt;br /&gt;
* a sequence of constraints (predicates) &amp;lt;math&amp;gt;C_1,C_2,\ldots, C_m&amp;lt;/math&amp;gt; defined on those variables.&lt;br /&gt;
The MAX-CSP asks to find an assignment of values to variables &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_n&amp;lt;/math&amp;gt; which maximizes the number of satisfied constraints.&lt;br /&gt;
&lt;br /&gt;
In particular, when the variables &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_n&amp;lt;/math&amp;gt; takes Boolean values &amp;lt;math&amp;gt;\{0,1\}&amp;lt;/math&amp;gt; and every constraint is a binary constraint &amp;lt;math&amp;gt;\cdot\neq\cdot&amp;lt;/math&amp;gt; in the form of &amp;lt;math&amp;gt;x_1\neq x_j&amp;lt;/math&amp;gt;, then the MAX-CSP is precisely the max-cut problem.&lt;br /&gt;
&lt;br /&gt;
Unlike the min-cut problem, which can be solved in polynomial time, the max-cut is known to be [https://en.wikipedia.org/wiki/NP-hardness &#039;&#039;&#039;NP-hard&#039;&#039;&#039;]. Its decision version is among the [https://en.wikipedia.org/wiki/Karp%27s_21_NP-complete_problems 21 &#039;&#039;&#039;NP-complete&#039;&#039;&#039; problems found by Karp]. This means we should not hope for a polynomial-time algorithm for solving the problem if [https://en.wikipedia.org/wiki/P_versus_NP_problem a famous conjecture in computational complexity] is correct. And due to another [https://en.wikipedia.org/wiki/BPP_(complexity)#Problems less famous conjecture in computational complexity], randomization alone probably cannot help this situation either.&lt;br /&gt;
&lt;br /&gt;
We may compromise our goal and allow algorithm to &#039;&#039;not always find the optimal solution&#039;&#039;. However, we still want to guarantee that the algorithm &#039;&#039;always returns a relatively good solution on all possible instances&#039;&#039;. This notion is formally captured by &#039;&#039;&#039;approximation algorithms&#039;&#039;&#039; and &#039;&#039;&#039;approximation ratio&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Greedy algorithm ==&lt;br /&gt;
A natural heuristics for solving the max-cut is to sequentially join the vertices to one of the two disjoint subsets &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; to &#039;&#039;greedily&#039;&#039; maximize the &#039;&#039;current&#039;&#039; number of edges crossing between &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
To state the algorithm, we overload the definition &amp;lt;math&amp;gt;E(S,T)&amp;lt;/math&amp;gt;. Given an undirected graph &amp;lt;math&amp;gt;G(V,E)&amp;lt;/math&amp;gt;, for any disjoint subsets &amp;lt;math&amp;gt;S,T\subseteq V&amp;lt;/math&amp;gt; of vertices, we define&lt;br /&gt;
:&amp;lt;math&amp;gt;E(S,T)=\{uv\in E\mid u\in S, v\in T\}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We also assume that the vertices are ordered arbitrarily as &amp;lt;math&amp;gt;V=\{v_1,v_2,\ldots,v_n\}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The greedy heuristics is then described as follows.&lt;br /&gt;
{{Theorem|&#039;&#039;GreedyMaxCut&#039;&#039;|&lt;br /&gt;
:&#039;&#039;&#039;Input:&#039;&#039;&#039; undirected graph &amp;lt;math&amp;gt;G(V,E)&amp;lt;/math&amp;gt;, &lt;br /&gt;
:::with an arbitrary order of vertices &amp;lt;math&amp;gt;V=\{v_1,v_2,\ldots,v_n\}&amp;lt;/math&amp;gt;;&lt;br /&gt;
----&lt;br /&gt;
:initially &amp;lt;math&amp;gt;S=T=\emptyset&amp;lt;/math&amp;gt;;&lt;br /&gt;
:for &amp;lt;math&amp;gt;i=1,2,\ldots,n&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;v_i&amp;lt;/math&amp;gt; joins one of &amp;lt;math&amp;gt;S,T&amp;lt;/math&amp;gt; to maximize the current &amp;lt;math&amp;gt;|E(S,T)|&amp;lt;/math&amp;gt; (breaking ties arbitrarily);&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The algorithm certainly runs in polynomial time.&lt;br /&gt;
&lt;br /&gt;
Without any guarantee of how good the solution returned by the algorithm approximates the optimal solution, the algorithm is only a heuristics, not an &#039;&#039;&#039;approximation algorithm&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Approximation ratio ===&lt;br /&gt;
For now we restrict ourselves to the max-cut problem, although the notion applies more generally.&lt;br /&gt;
&lt;br /&gt;
Let &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; be an arbitrary instance of max-cut problem. Let &amp;lt;math&amp;gt;OPT_G&amp;lt;/math&amp;gt; denote the size of the of max-cut in graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;. More precisely,&lt;br /&gt;
:&amp;lt;math&amp;gt;OPT_G=\max_{S\subseteq V}|E(S,\overline{S})|&amp;lt;/math&amp;gt;. &lt;br /&gt;
Let &amp;lt;math&amp;gt;SOL_G&amp;lt;/math&amp;gt; be the size of of the cut &amp;lt;math&amp;gt;|E(S,T)|&amp;lt;/math&amp;gt; returned by the &#039;&#039;GreedyMaxCut&#039;&#039; algorithm on input graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
As a maximization problem it is trivial that &amp;lt;math&amp;gt;SOL_G\le OPT_G&amp;lt;/math&amp;gt; for all &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;. To guarantee that the &#039;&#039;GreedyMaxCut&#039;&#039; gives good approximation of optimal solution, we need the other direction:&lt;br /&gt;
{{Theorem|Approximation ratio|&lt;br /&gt;
:We say that the &#039;&#039;&#039;approximation ratio&#039;&#039;&#039; of the &#039;&#039;GreedyMaxCut&#039;&#039; algorithm is &amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;, or &#039;&#039;GreedyMaxCut&#039;&#039; is an &#039;&#039;&#039;&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;-approximation&#039;&#039;&#039; algorithm, for some &amp;lt;math&amp;gt;0&amp;lt;\alpha\le 1&amp;lt;/math&amp;gt;, if &lt;br /&gt;
::&amp;lt;math&amp;gt;\frac{SOL_G}{OPT_G}\ge \alpha&amp;lt;/math&amp;gt; for every possible instance &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; of max-cut.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
With this notion, we now try to analyze the approximation ratio of the &#039;&#039;GreedyMaxCut&#039;&#039; algorithm.&lt;br /&gt;
&lt;br /&gt;
A dilemma to apply this notion in our analysis is that in the definition of approximation ratio, we compare the solution returned by the algorithm with the &#039;&#039;&#039;optimal solution&#039;&#039;&#039;. However, in the analysis we can hardly conduct similar comparisons to the optimal solutions. A fallacy in this logic is that the optimal solutions are &#039;&#039;&#039;NP-hard&#039;&#039;&#039;, meaning there is no easy way to calculate them (e.g. a closed form).&lt;br /&gt;
&lt;br /&gt;
A popular step (usually the first step of analyzing approximation ratio) to avoid this dilemma is that instead of directly comparing to the optimal solution, we compare to an &#039;&#039;&#039;upper bound&#039;&#039;&#039; of the optimal solution (for minimization problem, this needs to be a lower bound), that is, we compare to something which is even better than the optimal solution (which means it cannot be realized by any feasible solution).&lt;br /&gt;
&lt;br /&gt;
For the max-cut problem, a simple upper bound to &amp;lt;math&amp;gt;OPT_G&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;|E|&amp;lt;/math&amp;gt;, the number of all edges. This is a trivial upper bound of max-cut since any cut is a subset of edges.&lt;br /&gt;
&lt;br /&gt;
Let &amp;lt;math&amp;gt;G(V,E)&amp;lt;/math&amp;gt; be the input graph and &amp;lt;math&amp;gt;V=\{v_1,v_2,\ldots,v_n\}&amp;lt;/math&amp;gt;. Initially &amp;lt;math&amp;gt;S_1=T_1=\emptyset&amp;lt;/math&amp;gt;. And for &amp;lt;math&amp;gt;i=1,2,\ldots,n&amp;lt;/math&amp;gt;, we let &amp;lt;math&amp;gt;S_{i+1}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_{i+1}&amp;lt;/math&amp;gt; be the respective &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; after &amp;lt;math&amp;gt;v_i&amp;lt;/math&amp;gt; joins one of &amp;lt;math&amp;gt;S,T&amp;lt;/math&amp;gt;. More precisely,&lt;br /&gt;
* &amp;lt;math&amp;gt;S_{i+1}=S_i\cup\{v_i\}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_{i+1}=T_i\,&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt;E(S_{i}\cup\{v_i\},T_i)&amp;gt;E(S_{i},T_i\cup\{v_i\})&amp;lt;/math&amp;gt;;&lt;br /&gt;
* &amp;lt;math&amp;gt;S_{i+1}=S_i\,&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_{i+1}=T_i\cup\{v_i\}&amp;lt;/math&amp;gt;  if otherwise. &lt;br /&gt;
Finally, the max-cut is given by&lt;br /&gt;
:&amp;lt;math&amp;gt;SOL_G=|E(S_{n+1},T_{n+1})|&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We first observe that we can count the number of edges &amp;lt;math&amp;gt;|E|&amp;lt;/math&amp;gt; by summarizing the contributions of individual &amp;lt;math&amp;gt;v_i&amp;lt;/math&amp;gt;&#039;s.&lt;br /&gt;
{{Theorem|Proposition 1|&lt;br /&gt;
:&amp;lt;math&amp;gt;|E| = \sum_{i=1}^n\left(|E(S_i,\{v_i\})|+|E(T_i,\{v_i\})|\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
{{Proof|&lt;br /&gt;
Note that &amp;lt;math&amp;gt;S_i\cup T_i=\{v_1,v_2,\ldots,v_{i-1}\}&amp;lt;/math&amp;gt;, i.e. &amp;lt;math&amp;gt;S_i&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_i&amp;lt;/math&amp;gt; together contain precisely those vertices preceding &amp;lt;math&amp;gt;v_i&amp;lt;/math&amp;gt;. Therefore, by taking the sum &lt;br /&gt;
:&amp;lt;math&amp;gt;\sum_{i=1}^n\left(|E(S_i,\{v_i\})|+|E(T_i,\{v_i\})|\right)&amp;lt;/math&amp;gt;,&lt;br /&gt;
we effectively enumerate all &amp;lt;math&amp;gt;(v_j,v_i)&amp;lt;/math&amp;gt; that &amp;lt;math&amp;gt;v_jv_i\in E&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;j&amp;lt;i&amp;lt;/math&amp;gt;. The total number is precisely &amp;lt;math&amp;gt;|E|&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
We then observe that the &amp;lt;math&amp;gt;SOL_G&amp;lt;/math&amp;gt; can be decomposed into contributions of individual &amp;lt;math&amp;gt;v_i&amp;lt;/math&amp;gt;&#039;s in the same way.&lt;br /&gt;
{{Theorem|Proposition 2|&lt;br /&gt;
:&amp;lt;math&amp;gt;SOL_G = \sum_{i=1}^n\max\left(|E(S_i, \{v_i\})|,|E(T_i, \{v_i\})|\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
{{Proof|&lt;br /&gt;
It is east to observe that &amp;lt;math&amp;gt;E(S_i,T_i)\subseteq E(S_{i+1},T_{i+1})&amp;lt;/math&amp;gt;, i.e. once an edge joins the cut between current &amp;lt;math&amp;gt;S,T&amp;lt;/math&amp;gt; it will never drop from the cut in the future. &lt;br /&gt;
&lt;br /&gt;
We then define &lt;br /&gt;
:&amp;lt;math&amp;gt;\Delta_i= |E(S_{i+1},T_{i+1})|-|E(S_i,T_i)|=|E(S_{i+1},T_{i+1})\setminus E(S_i,T_i)|&amp;lt;/math&amp;gt;&lt;br /&gt;
to be the contribution of &amp;lt;math&amp;gt;v_i&amp;lt;/math&amp;gt; in the final cut.&lt;br /&gt;
&lt;br /&gt;
It holds that&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum_{i=1}^n\Delta_i=|E(S_{n+1},T_{n+1})|-|E(S_{1},T_{1})|=|E(S_{n+1},T_{n+1})|=SOL_G&amp;lt;/math&amp;gt;.&lt;br /&gt;
On the other hand, due to the greedy rule:&lt;br /&gt;
* &amp;lt;math&amp;gt;S_{i+1}=S_i\cup\{v_i\}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_{i+1}=T_i\,&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt;E(S_{i}\cup\{v_i\},T_i)&amp;gt;E(S_{i},T_i\cup\{v_i\})&amp;lt;/math&amp;gt;;&lt;br /&gt;
* &amp;lt;math&amp;gt;S_{i+1}=S_i\,&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_{i+1}=T_i\cup\{v_i\}&amp;lt;/math&amp;gt;  if otherwise;&lt;br /&gt;
it holds that&lt;br /&gt;
:&amp;lt;math&amp;gt;\Delta_i=|E(S_{i+1},T_{i+1})\setminus E(S_i,T_i)| = \max\left(|E(S_i, \{v_i\})|,|E(T_i, \{v_i\})|\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
Together the proposition follows.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Combining the above Proposition 1 and Proposition 2, we have&lt;br /&gt;
:&amp;lt;math&amp;gt; &lt;br /&gt;
\begin{align}&lt;br /&gt;
SOL_G &lt;br /&gt;
&amp;amp;= \sum_{i=1}^n\max\left(|E(S_i, \{v_i\})|,|E(T_i, \{v_i\})|\right)\\&lt;br /&gt;
&amp;amp;\ge \frac{1}{2}\sum_{i=1}^n\left(|E(S_i, \{v_i\})|+|E(T_i, \{v_i\})|\right)\\&lt;br /&gt;
&amp;amp;=\frac{1}{2}|E|\\&lt;br /&gt;
&amp;amp;\ge\frac{1}{2}OPT_G.&lt;br /&gt;
\end{align}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Theorem|Theorem|&lt;br /&gt;
:The &#039;&#039;GreedyMaxCut&#039;&#039; is a &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;-approximation algorithm for the max-cut problem.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
This is not the best approximation ratio achieved by polynomial-time algorithms for max-cut.&lt;br /&gt;
* The best known approximation ratio achieved by any polynomial-time algorithm is achieved by the [http://www-math.mit.edu/~goemans/PAPERS/maxcut-jacm.pdf Goemans-Williamson algorithm], which relies on rounding an [https://en.wikipedia.org/wiki/Semidefinite_programming SDP] relaxation of the max-cut, and achieves an approximation ratio &amp;lt;math&amp;gt;\alpha^*\approx 0.878&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;\alpha^*&amp;lt;/math&amp;gt; is an irrational whose precise value is given by &amp;lt;math&amp;gt;\alpha^*=\frac{2}{\pi}\inf_{x\in[-1,1]}\frac{\arccos(x)}{1-x}&amp;lt;/math&amp;gt;.&lt;br /&gt;
* Assuming the [https://en.wikipedia.org/wiki/Unique_games_conjecture unique game conjecture], there does not exist any polynomial-time algorithm for max-cut with approximation ratio &amp;lt;math&amp;gt;\alpha&amp;gt;\alpha^*&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Derandomization by conditional expectation ==&lt;br /&gt;
There is a probabilistic interpretation of the greedy algorithm, which may explains why we use greedy scheme for max-cut and why it works for finding an approximate max-cut.&lt;br /&gt;
&lt;br /&gt;
Given an undirected graph &amp;lt;math&amp;gt;G(V,E)&amp;lt;/math&amp;gt;, let us calculate the average size of cuts in &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;. For every vertex &amp;lt;math&amp;gt;v\in V&amp;lt;/math&amp;gt; let &amp;lt;math&amp;gt;X_v\in\{0,1\}&amp;lt;/math&amp;gt; be a &#039;&#039;uniform&#039;&#039; and &#039;&#039;independent&#039;&#039; random bit which indicates whether &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; joins &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;. This gives us a uniform random bipartition of &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The size of the random cut &amp;lt;math&amp;gt;|E(S,T)|&amp;lt;/math&amp;gt; is given by&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
|E(S,T)| = \sum_{uv\in E} I[X_u\neq X_v],&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math&amp;gt;I[X_u\neq X_v]&amp;lt;/math&amp;gt; is the Boolean indicator random variable that indicates whether event &amp;lt;math&amp;gt;X_u\neq X_v&amp;lt;/math&amp;gt; occurs.&lt;br /&gt;
&lt;br /&gt;
Due to &#039;&#039;&#039;linearity of expectation&#039;&#039;&#039;,&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\mathbb{E}[|E(S,T)|]=\sum_{uv\in E} \mathbb{E}[I[X_u\neq X_v]] =\sum_{uv\in E} \Pr[X_u\neq X_v]=\frac{|E|}{2}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
Recall that &amp;lt;math&amp;gt;|E|&amp;lt;/math&amp;gt; is a trivial upper bound for the max-cut &amp;lt;math&amp;gt;OPT_G&amp;lt;/math&amp;gt;. Due to the above argument, we have &lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\mathbb{E}[|E(S,T)|]\ge\frac{OPT_G}{2}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
:{|border=&amp;quot;2&amp;quot; width=&amp;quot;100%&amp;quot; cellspacing=&amp;quot;4&amp;quot; cellpadding=&amp;quot;3&amp;quot; rules=&amp;quot;all&amp;quot; style=&amp;quot;margin:1em 1em 1em 0; border:solid 1px #AAAAAA; border-collapse:collapse;empty-cells:show;&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
*In above argument we use a few probability propositions.&lt;br /&gt;
: &#039;&#039;&#039;linearity of expectation:&#039;&#039;&#039;&lt;br /&gt;
:: Let &amp;lt;math&amp;gt;\boldsymbol{X}=(X_1,X_2,\ldots,X_n)&amp;lt;/math&amp;gt; be a random vector. Then&lt;br /&gt;
:::&amp;lt;math&amp;gt;\mathbb{E}\left[\sum_{i=1}^nc_iX_i\right]=\sum_{i=1}^nc_i\mathbb{E}[X_i]&amp;lt;/math&amp;gt;,&lt;br /&gt;
::where &amp;lt;math&amp;gt;c_1,c_2,\ldots,c_n&amp;lt;/math&amp;gt; are scalars.&lt;br /&gt;
::That is, the order of computations of expectation and linear (affine) function of a random vector can be exchanged. &lt;br /&gt;
::Note that this property ignores the dependency between random variables, and hence is very useful.&lt;br /&gt;
:&#039;&#039;&#039;Expectation of indicator random variable:&#039;&#039;&#039;&lt;br /&gt;
::We usually use the notation &amp;lt;math&amp;gt;I[A]&amp;lt;/math&amp;gt; to represent the Boolean indicator random variable that indicates whether the event &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; occurs: i.e. &amp;lt;math&amp;gt;I[A]=1&amp;lt;/math&amp;gt; if event &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; occurs and &amp;lt;math&amp;gt;I[A]=0&amp;lt;/math&amp;gt; if otherwise. &lt;br /&gt;
::It is easy to see that &amp;lt;math&amp;gt;\mathbb{E}[I[A]]=\Pr[A]&amp;lt;/math&amp;gt;. The expectation of an indicator random variable equals the probability of the event it indicates.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
By above analysis, the average (under uniform distribution) size of all cuts in any graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; must be at least &amp;lt;math&amp;gt;\frac{OPT_G}{2}&amp;lt;/math&amp;gt;. Due to &#039;&#039;&#039;the probabilistic method&#039;&#039;&#039;, in particular &#039;&#039;&#039;the averaging principle&#039;&#039;&#039;, there must exists a bipartition of &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; whose cut &amp;lt;math&amp;gt;E(S,T)&amp;lt;/math&amp;gt; is of size at least &amp;lt;math&amp;gt;\frac{OPT_G}{2}&amp;lt;/math&amp;gt;. Then next question is how to find such a bipartition &amp;lt;math&amp;gt;\{S,T\}&amp;lt;/math&amp;gt; &#039;&#039;algorithmically&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
We still fix an arbitrary order of all vertices as &amp;lt;math&amp;gt;V=\{v_1,v_2,\ldots,v_n\}&amp;lt;/math&amp;gt;. Recall that each vertex &amp;lt;math&amp;gt;v_i&amp;lt;/math&amp;gt; is associated with a uniform and independent random bit &amp;lt;math&amp;gt;X_{v_i}&amp;lt;/math&amp;gt; to indicate whether &amp;lt;math&amp;gt;v_i&amp;lt;/math&amp;gt; joins &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;. We want to fix the value of &amp;lt;math&amp;gt;X_{v_i}&amp;lt;/math&amp;gt; one after another to construct a bipartition &amp;lt;math&amp;gt;\{\hat{S},\hat{T}\}&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; such that &lt;br /&gt;
:&amp;lt;math&amp;gt;|E(\hat{S},\hat{T})|\ge\mathbb{E}[|E(S,T)|]\ge\frac{OPT_G}{2}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We start with the first vertex &amp;lt;math&amp;gt;v_i&amp;lt;/math&amp;gt; and its random variable &amp;lt;math&amp;gt;X_{v_1}&amp;lt;/math&amp;gt;. By the &#039;&#039;&#039;law of total expectation&#039;&#039;&#039;,&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\mathbb{E}[E(S,T)]=\frac{1}{2}\mathbb{E}[E(S,T)\mid X_{v_1}=0]+\frac{1}{2}\mathbb{E}[E(S,T)\mid X_{v_1}=1].&lt;br /&gt;
&amp;lt;/math&amp;gt; &lt;br /&gt;
There must exist an assignment &amp;lt;math&amp;gt;x_1\in\{0,1\}&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;X_{v_1}&amp;lt;/math&amp;gt; such that &lt;br /&gt;
:&amp;lt;math&amp;gt;\mathbb{E}[E(S,T)\mid X_{v_1}=x_1]\ge \mathbb{E}[E(S,T)]&amp;lt;/math&amp;gt;.&lt;br /&gt;
We can continuously applying this argument. In general, for any &amp;lt;math&amp;gt;i\le n&amp;lt;/math&amp;gt; and any particular partial assignment &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_{i-1}\in\{0,1\}&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;X_{v_1},X_{v_2},\ldots,X_{v_{i-1}}&amp;lt;/math&amp;gt;, by the law of total expectation&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{align}&lt;br /&gt;
\mathbb{E}[E(S,T)\mid X_{v_1}=x_1,\ldots, X_{v_{i-1}}=x_{i-1}]&lt;br /&gt;
=&lt;br /&gt;
&amp;amp;\frac{1}{2}\mathbb{E}[E(S,T)\mid X_{v_1}=x_1,\ldots, X_{v_{i-1}}=x_{i-1}, X_{v_{i}}=0]\\&lt;br /&gt;
&amp;amp;+\frac{1}{2}\mathbb{E}[E(S,T)\mid X_{v_1}=x_1,\ldots, X_{v_{i-1}}=x_{i-1}, X_{v_{i}}=1].&lt;br /&gt;
\end{align}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
There must exist an assignment &amp;lt;math&amp;gt;x_{i}\in\{0,1\}&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;X_{v_i}&amp;lt;/math&amp;gt; such that &lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\mathbb{E}[E(S,T)\mid X_{v_1}=x_1,\ldots, X_{v_{i}}=x_{i}]\ge \mathbb{E}[E(S,T)\mid X_{v_1}=x_1,\ldots, X_{v_{i-1}}=x_{i-1}].&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
By this argument, we can find a sequence &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_n\in\{0,1\}&amp;lt;/math&amp;gt; of bits which forms a &#039;&#039;monotone path&#039;&#039;:&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\mathbb{E}[E(S,T)]\le \cdots \le \mathbb{E}[E(S,T)\mid X_{v_1}=x_1,\ldots, X_{v_{i-1}}=x_{i-1}] \le \mathbb{E}[E(S,T)\mid X_{v_1}=x_1,\ldots, X_{v_{i}}=x_{i}] \le \cdots \le  \mathbb{E}[E(S,T)\mid X_{v_1}=x_1,\ldots, X_{v_{n}}=x_{n}].&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
We already know the first step of this monotone path &amp;lt;math&amp;gt;\mathbb{E}[E(S,T)]\ge\frac{OPT_G}{2}&amp;lt;/math&amp;gt;. And for the last step of the monotone path &amp;lt;math&amp;gt;\mathbb{E}[E(S,T)\mid X_{v_1}=x_1,\ldots, X_{v_{n}}=x_{n}]&amp;lt;/math&amp;gt; since all random bits have been fixed, a bipartition &amp;lt;math&amp;gt;(\hat{S},\hat{T})&amp;lt;/math&amp;gt; is determined by the assignment &amp;lt;math&amp;gt;x_1,\ldots, x_n&amp;lt;/math&amp;gt;, so the expectation has no effect except just retuning the size of that cut &amp;lt;math&amp;gt;|E(\hat{S},\hat{T})|&amp;lt;/math&amp;gt;. We found the cut &amp;lt;math&amp;gt;E(\hat{S},\hat{T})&amp;lt;/math&amp;gt; such that &amp;lt;math&amp;gt;|E(\hat{S},\hat{T})|\ge \frac{OPT_G}{2}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We translate the procedure of constructing this monotone path of conditional expectation to the following algorithm. &lt;br /&gt;
{{Theorem|&#039;&#039;MonotonePath&#039;&#039;|&lt;br /&gt;
:&#039;&#039;&#039;Input:&#039;&#039;&#039; undirected graph &amp;lt;math&amp;gt;G(V,E)&amp;lt;/math&amp;gt;, &lt;br /&gt;
:::with an arbitrary order of vertices &amp;lt;math&amp;gt;V=\{v_1,v_2,\ldots,v_n\}&amp;lt;/math&amp;gt;;&lt;br /&gt;
----&lt;br /&gt;
:initially &amp;lt;math&amp;gt;S=T=\emptyset&amp;lt;/math&amp;gt;;&lt;br /&gt;
:for &amp;lt;math&amp;gt;i=1,2,\ldots,n&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;v_i&amp;lt;/math&amp;gt; joins one of &amp;lt;math&amp;gt;S,T&amp;lt;/math&amp;gt; to maximize the average size of cut conditioning on the choices made so far by the vertices &amp;lt;math&amp;gt;v_1,v_2,\ldots,v_i&amp;lt;/math&amp;gt;;&lt;br /&gt;
}}&lt;br /&gt;
We leave as an exercise to verify that the choice of each &amp;lt;math&amp;gt;v_i&amp;lt;/math&amp;gt; (to join which one of &amp;lt;math&amp;gt;S,T&amp;lt;/math&amp;gt;) in the &#039;&#039;MonotonePath&#039;&#039; algorithm (which maximizes the average size of cut conditioning on the choices made so far by the vertices &amp;lt;math&amp;gt;v_1,v_2,\ldots,v_i&amp;lt;/math&amp;gt;) must be the same choice made by &amp;lt;math&amp;gt;v_i&amp;lt;/math&amp;gt; in the &#039;&#039;GreedyMaxCut&#039;&#039; algorithm (which maximizes the current &amp;lt;math&amp;gt;|E(S,T)|&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
Therefore, the greedy algorithm for max-cut is actually due to a derandomization of average-case.&lt;br /&gt;
&lt;br /&gt;
== Derandomization by pairwise independence ==&lt;br /&gt;
We still construct a random bipartition of &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;. But this time the random choices have &#039;&#039;&#039;bounded independence&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
For each vertex &amp;lt;math&amp;gt;v\in V&amp;lt;/math&amp;gt;, we use a Boolean random variable &amp;lt;math&amp;gt;Y_v\in\{0,1\}&amp;lt;/math&amp;gt; to indicate whether &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; joins &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;. The dependencies between &amp;lt;math&amp;gt;Y_v&amp;lt;/math&amp;gt;&#039;s are to be specified later.&lt;br /&gt;
&lt;br /&gt;
By linearity of expectation, regardless of the dependencies between &amp;lt;math&amp;gt;Y_v&amp;lt;/math&amp;gt;&#039;s, it holds that:&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\mathbb{E}[|E(S,T)|]=\sum_{uv\in E} \Pr[Y_u\neq Y_v].&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
In order to have the average cut &amp;lt;math&amp;gt;\mathbb{E}[|E(S,T)|]=\frac{|E|}{2}&amp;lt;/math&amp;gt; as the fully random case, we need &amp;lt;math&amp;gt;\Pr[Y_u\neq Y_v]=\frac{1}{2}&amp;lt;/math&amp;gt;. This only requires that the Boolean random variables &amp;lt;math&amp;gt;Y_v&amp;lt;/math&amp;gt;&#039;s are uniform and &#039;&#039;&#039;pairwise independent&#039;&#039;&#039; instead of being &#039;&#039;&#039;mutually independent&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; pairwise independent random bits &amp;lt;math&amp;gt;\{Y_v\}_{v\in V}&amp;lt;/math&amp;gt; can be constructed by at most &amp;lt;math&amp;gt;k=\lceil\log (n+1)\rceil&amp;lt;/math&amp;gt; mutually independent random bits &amp;lt;math&amp;gt;X_1,X_2,\ldots,X_k\in\{0,1\}&amp;lt;/math&amp;gt; by the following standard routine.&lt;br /&gt;
&lt;br /&gt;
{{Theorem|Theorem|&lt;br /&gt;
:Let &amp;lt;math&amp;gt;X_1, X_2, \ldots, X_k\in\{0,1\}&amp;lt;/math&amp;gt; be mutually independent uniform random bits. &lt;br /&gt;
:Let &amp;lt;math&amp;gt;S_1, S_2, \ldots, S_{2^k-1}\subseteq \{1,2,\ldots,k\}&amp;lt;/math&amp;gt; enumerate the &amp;lt;math&amp;gt;2^k-1&amp;lt;/math&amp;gt; nonempty subsets of &amp;lt;math&amp;gt;\{1,2,\ldots,k\}&amp;lt;/math&amp;gt;. &lt;br /&gt;
:For each &amp;lt;math&amp;gt;i\le i\le2^k-1&amp;lt;/math&amp;gt;, let &lt;br /&gt;
::&amp;lt;math&amp;gt;Y_i=\bigoplus_{j\in S_i}X_j=\left(\sum_{j\in S_i}X_j\right)\bmod 2.&amp;lt;/math&amp;gt;&lt;br /&gt;
:Then &amp;lt;math&amp;gt;Y_1,Y_2,\ldots,Y_{2^k-1}&amp;lt;/math&amp;gt; are pairwise independent uniform random bits.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;math&amp;gt;Y_v&amp;lt;/math&amp;gt; for each vertex &amp;lt;math&amp;gt;v\in V&amp;lt;/math&amp;gt; is constructed in this way by at most &amp;lt;math&amp;gt;k=\lceil\log (n+1)\rceil&amp;lt;/math&amp;gt; mutually independent random bits &amp;lt;math&amp;gt;X_1,X_2,\ldots,X_k\in\{0,1\}&amp;lt;/math&amp;gt;, then they are uniform and pairwise independent, which by the above calculation, it holds for the corresponding bipartition &amp;lt;math&amp;gt;\{S,T\}&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; that&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\mathbb{E}[|E(S,T)|]=\sum_{uv\in E} \Pr[Y_u\neq Y_v]=\frac{|E|}{2}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
Note that the average is taken over the random choices of &amp;lt;math&amp;gt;X_1,X_2,\ldots,X_k\in\{0,1\}&amp;lt;/math&amp;gt; (because they are the only random choices used to construct the bipartition &amp;lt;math&amp;gt;\{S,T\}&amp;lt;/math&amp;gt;). By the probabilistic method, there must exist an assignment of &amp;lt;math&amp;gt;X_1,X_2,\ldots,X_k\in\{0,1\}&amp;lt;/math&amp;gt; such that the corresponding &amp;lt;math&amp;gt;Y_v&amp;lt;/math&amp;gt;&#039;s and the bipartition &amp;lt;math&amp;gt;\{S,T\}&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; indicated by the &amp;lt;math&amp;gt;Y_v&amp;lt;/math&amp;gt;&#039;s have that &lt;br /&gt;
:&amp;lt;math&amp;gt;|E(S,T)|\ge \frac{|E|}{2}\ge\frac{OPT}{2}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
This gives us the following algorithm for exhaustive search in a smaller solution space of size &amp;lt;math&amp;gt;2^k-1=O(n^2)&amp;lt;/math&amp;gt;.&lt;br /&gt;
{{Theorem|Algorithm|&lt;br /&gt;
:Enumerate vertices as &amp;lt;math&amp;gt;V=\{v_1,v_2,\ldots,v_n\}&amp;lt;/math&amp;gt;;&lt;br /&gt;
:let &amp;lt;math&amp;gt;k=\lceil\log (n+1)\rceil&amp;lt;/math&amp;gt;;&lt;br /&gt;
:for all &amp;lt;math&amp;gt;\vec{x}\in\{0,1\}^k&amp;lt;/math&amp;gt;&lt;br /&gt;
::initialize &amp;lt;math&amp;gt;S_{\vec{x}}=T_{\vec{x}}=\emptyset&amp;lt;/math&amp;gt;;&lt;br /&gt;
::for &amp;lt;math&amp;gt;i=1, 2, \ldots, n&amp;lt;/math&amp;gt;&lt;br /&gt;
:::if &amp;lt;math&amp;gt;\bigoplus_{j:\lfloor i/2^j\rfloor\bmod 2=1}x_j=1&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;v_i&amp;lt;/math&amp;gt; joins &amp;lt;math&amp;gt;S_{\vec{x}}&amp;lt;/math&amp;gt;;&lt;br /&gt;
:::else &amp;lt;math&amp;gt;v_i&amp;lt;/math&amp;gt; joins &amp;lt;math&amp;gt;T_{\vec{x}}&amp;lt;/math&amp;gt;;&lt;br /&gt;
:return the &amp;lt;math&amp;gt;\{S_{\vec{x}},T_{\vec{x}}\}&amp;lt;/math&amp;gt; with the largest &amp;lt;math&amp;gt;|E(S_{\vec{x}},T_{\vec{x}})|&amp;lt;/math&amp;gt;;&lt;br /&gt;
}}&lt;br /&gt;
The algorithm has approximation ratio 1/2 and runs in polynomial time.&lt;br /&gt;
&lt;br /&gt;
= Spectral Cut =&lt;br /&gt;
== Expansion, Conductance and Sparsest Cut in Regular Graphs==&lt;br /&gt;
Consider an undirected &amp;lt;math&amp;gt;d&amp;lt;/math&amp;gt;-regular (multi-)graph &amp;lt;math&amp;gt;G(V,E)&amp;lt;/math&amp;gt;, where the parallel edges between two vertices are allowed.&lt;br /&gt;
For &amp;lt;math&amp;gt;S,T\subset V&amp;lt;/math&amp;gt;, let &amp;lt;math&amp;gt;E(S,T)=\{uv\in E\mid u\in S,v\in T\}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Theorem&lt;br /&gt;
|Definition (Edge expansion)|&lt;br /&gt;
:The &#039;&#039;&#039;Edge expansion&#039;&#039;&#039; of an undirected graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; on &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; vertices, is defined as&lt;br /&gt;
::&amp;lt;math&amp;gt;&lt;br /&gt;
h(G)=\min_{\overset{S\subset V}{|S|\le\frac{n}{2}}} \frac{|E(S, \bar{S}|}{|S|}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
As a side note, the edge expansion in a irregular graph has exactly the same definition.&lt;br /&gt;
The edge expansion is a very hard to approximate problem. Under the [https://en.wikipedia.org/wiki/Unique_games_conjecture Unique games conjecture], it is NP-hard to approximate within constant factors.&lt;br /&gt;
&lt;br /&gt;
{{Theorem&lt;br /&gt;
|Definition (Conductance)|&lt;br /&gt;
:The &#039;&#039;&#039;Conductance&#039;&#039;&#039; of an undirected graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; on &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; vertices, is defined as&lt;br /&gt;
::&amp;lt;math&amp;gt;&lt;br /&gt;
\varphi(G)=h(G)/d.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Theorem&lt;br /&gt;
|Definition (Sparsest cut)|&lt;br /&gt;
:The &#039;&#039;&#039;Sparsest cut&#039;&#039;&#039; of an undirected graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; on &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; vertices, is a set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; minimizing&lt;br /&gt;
::&amp;lt;math&amp;gt;&lt;br /&gt;
\frac{|E(S, \bar{S}|}{\min\{|S|,|\bar{S}|\}}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Spectrum of Regular Graphs==&lt;br /&gt;
The &#039;&#039;&#039;adjacency matrix&#039;&#039;&#039; of an &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;-vertex graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;, denoted &amp;lt;math&amp;gt;A = A(G)&amp;lt;/math&amp;gt;, is an &amp;lt;math&amp;gt;n\times n&amp;lt;/math&amp;gt; matrix where &amp;lt;math&amp;gt;A(u,v)&amp;lt;/math&amp;gt; is the number of edges in &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; between vertex &amp;lt;math&amp;gt;u&amp;lt;/math&amp;gt; and vertex &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt;. Because &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; is a symmetric matrix with real entries, due to the [https://en.wikipedia.org/wiki/Spectral_theorem Spectral theorem], it has real eigenvalues &amp;lt;math&amp;gt;\lambda_1\ge\lambda_2\ge\cdots\ge\lambda_n&amp;lt;/math&amp;gt;, which associate with an orthonormal system of eigenvectors &amp;lt;math&amp;gt;v_1,v_2,\ldots, v_n\,&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;Av_i=\lambda_i v_i\,&amp;lt;/math&amp;gt;. We call the eigenvalues of &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; the &#039;&#039;&#039;spectrum&#039;&#039;&#039; of the graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The spectrum of a graph carries a lot of information about the graph. For example, suppose that &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;d&amp;lt;/math&amp;gt;-regular, the following lemma holds.&lt;br /&gt;
{{Theorem&lt;br /&gt;
|Lemma|&lt;br /&gt;
# &amp;lt;math&amp;gt;|\lambda_i|\le d&amp;lt;/math&amp;gt; for all &amp;lt;math&amp;gt;1\le i\le n&amp;lt;/math&amp;gt;.&lt;br /&gt;
# &amp;lt;math&amp;gt;\lambda_1=d&amp;lt;/math&amp;gt; and the corresponding eigenvector is &amp;lt;math&amp;gt;\vec{1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
# &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; is connected if and only if &amp;lt;math&amp;gt;\lambda_2&amp;lt;\lambda_1&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
{{Proof| Let &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; be the adjacency matrix of &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;, with entries &amp;lt;math&amp;gt;a_{ij}&amp;lt;/math&amp;gt;. It is obvious that &amp;lt;math&amp;gt;\sum_{j}a_{ij}=d\,&amp;lt;/math&amp;gt; for any &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt;.&lt;br /&gt;
*(1) Suppose that &amp;lt;math&amp;gt;Ax=\lambda x, x\neq \mathbf{0}&amp;lt;/math&amp;gt;, and let &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt; be an entry of &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; with the largest absolute value. Since &amp;lt;math&amp;gt;(Ax)_i=\lambda x_i&amp;lt;/math&amp;gt;, we have &lt;br /&gt;
::&amp;lt;math&amp;gt;&lt;br /&gt;
\sum_{j}a_{ij}x_j=\lambda x_i,\,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
:and so&lt;br /&gt;
::&amp;lt;math&amp;gt;&lt;br /&gt;
|\lambda||x_i|=\left|\sum_{j}a_{ij}x_j\right|\le \sum_{j}a_{ij}|x_j|\le \sum_{j}a_{ij}|x_i| \le d|x_i|.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
:Thus &amp;lt;math&amp;gt;|\lambda|\le d&amp;lt;/math&amp;gt;.&lt;br /&gt;
*(2) is easy to check.&lt;br /&gt;
*(3) Suppose that &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; is connected. Let &amp;lt;math&amp;gt;x\neq 0&amp;lt;/math&amp;gt; be an eigenvector for which &amp;lt;math&amp;gt;Ax=dx&amp;lt;/math&amp;gt;. Without loss of generality we can assume that &amp;lt;math&amp;gt;\max_i x_i&amp;gt;0 &amp;lt;/math&amp;gt;.&lt;br /&gt;
:We first show that &amp;lt;math&amp;gt;\forall i\left(x_i = \max_j x_j \implies \forall k\sim i, x_k=x_i \right).&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:This claim will imply that &amp;lt;math&amp;gt;x=c\vec{1}&amp;lt;/math&amp;gt; for a connected graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;, so we prove it next, by contradiction. &lt;br /&gt;
:Let &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt; be an entry of &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; with the largest absolute value. Suppose that &amp;lt;math&amp;gt;\exists k\sim i, x_k &amp;lt; x_i&amp;lt;/math&amp;gt;. Since &amp;lt;math&amp;gt;\sum_{j}a_{ij}=d&amp;lt;/math&amp;gt; and $x_j \le x_i$, we have &lt;br /&gt;
::&amp;lt;math&amp;gt;&lt;br /&gt;
\sum_{j}a_{ij}x_j &amp;lt; d x_i.\,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
:However,&lt;br /&gt;
::&amp;lt;math&amp;gt;&lt;br /&gt;
(Ax)_i=d x_i \implies \sum_{j}a_{ij}x_j=d x_i.\,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
:A contradiction. So it follows that &amp;lt;math&amp;gt;x_j=x_i&amp;lt;/math&amp;gt; for all &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;a_{ij}&amp;gt;0&amp;lt;/math&amp;gt;, which verifies the claim. Since &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; is connected, &amp;lt;math&amp;gt;x=c\vec{1}&amp;lt;/math&amp;gt;, and the eigenvalue &amp;lt;math&amp;gt;d=\lambda_1&amp;lt;/math&amp;gt; has multiplicity 1, thus &amp;lt;math&amp;gt;\lambda_1&amp;gt;\lambda_2&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:Conversely, suppose that &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; is disconnected with components &amp;lt;math&amp;gt;G_1 \uplus G_2 = G&amp;lt;/math&amp;gt;, we have &amp;lt;math&amp;gt;&lt;br /&gt;
A(G) = \begin{pmatrix}&lt;br /&gt;
A(G_1) &amp;amp; 0\\&lt;br /&gt;
0 &amp;amp; A(G_2)&lt;br /&gt;
\end{pmatrix}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Therefore, &amp;lt;math&amp;gt;A\vec{1}_{G_1}=d\vec{1}_{G_1}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;A\vec{1}_{G_2}=d\vec{1}_{G_2}&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;\vec{1}_{G_1}, \vec{1}_{G_2}&amp;lt;/math&amp;gt; are all-one vectors only supported  on &amp;lt;math&amp;gt;G_1, G_2&amp;lt;/math&amp;gt; respectively. Since &amp;lt;math&amp;gt;\vec{1}_{G_1}, \vec{1}_{G_2}&amp;lt;/math&amp;gt; are linearly independent, the multiplicity of eigenvalue &amp;lt;math&amp;gt;d&amp;lt;/math&amp;gt; is greater than 1, so &amp;lt;math&amp;gt;\lambda_1=\lambda_2&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Spectral Partitioning Algorithm ==&lt;br /&gt;
This is a popular heuristic in practice:&lt;br /&gt;
{{Theorem&lt;br /&gt;
|Spectral Partitioning Algorithm|&lt;br /&gt;
# Compute the second largest eigenvalue of the adjacency matrix and its corresponding eigenvector &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt;&lt;br /&gt;
# Sort the vertices &amp;lt;math&amp;gt; V=\{ u_1, \ldots, u_n\} &amp;lt;/math&amp;gt; so that &amp;lt;math&amp;gt; x(u_1) \ge x(u_2) \ge \ldots \ge x(u_n) &amp;lt;/math&amp;gt;&lt;br /&gt;
# Let &amp;lt;math&amp;gt; S_i:=\begin{cases}&lt;br /&gt;
\{1,2,\ldots,i\}, \qquad&amp;amp;\hbox{ if }i\le n/2 \\&lt;br /&gt;
V \setminus \{1,2,\ldots,i\}, &amp;amp;\hbox{ otherwise}&lt;br /&gt;
\end{cases} &amp;lt;/math&amp;gt;, and output &amp;lt;math&amp;gt; i = \arg\min_{1\le i \le n} \{ \varphi(S_i)\} &amp;lt;/math&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The performance guarantee of this algorithm comes from the Cheeger&#039;s inequality. In the worst-case, it only guarantees that the output set &amp;lt;math&amp;gt;S_i&amp;lt;/math&amp;gt; has conductance &amp;lt;math&amp;gt;\varphi(S_i) \le 2 \sqrt{\varphi(G)}&amp;lt;/math&amp;gt;. &lt;br /&gt;
In practice however, the performance is usually much better. We will discuss an improved Cheeger&#039;s inequality under additional assumptions on spectral gap later in class, which explains the effectiveness of the algorithm in practice.&lt;br /&gt;
&lt;br /&gt;
== Graph visualization ==&lt;br /&gt;
See slides.&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=%E9%AB%98%E7%BA%A7%E7%AE%97%E6%B3%95_(Fall_2024)/Hashing_and_Sketching&amp;diff=12637</id>
		<title>高级算法 (Fall 2024)/Hashing and Sketching</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=%E9%AB%98%E7%BA%A7%E7%AE%97%E6%B3%95_(Fall_2024)/Hashing_and_Sketching&amp;diff=12637"/>
		<updated>2024-10-02T12:21:22Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: /* 2-universal hash families */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Balls into Bins=&lt;br /&gt;
The following is the so-called balls into bins model.&lt;br /&gt;
Consider throwing &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; balls into &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; bins uniformly and independently at random. This is equivalent to a random mapping &amp;lt;math&amp;gt;f:[m]\to[n]&amp;lt;/math&amp;gt;. Needless to say, random mapping is an important random model and may have many applications in Computer Science, e.g. hashing.&lt;br /&gt;
&lt;br /&gt;
We are concerned with the following three questions regarding the balls into bins model:&lt;br /&gt;
* birthday problem: the probability that every bin contains at most one ball (the mapping is 1-1);&lt;br /&gt;
* coupon collector problem: the probability that every bin contains at least one ball (the mapping is on-to);&lt;br /&gt;
* occupancy problem: the maximum load of bins.&lt;br /&gt;
&lt;br /&gt;
== Birthday Problem==&lt;br /&gt;
We now consider the &#039;&#039;&#039;birthday problem&#039;&#039;&#039;.&lt;br /&gt;
There are &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; students in the class. Assume that for each student, his/her birthday is uniformly and independently distributed over the 365 days in a years. We wonder what the probability that no two students share a birthday.&lt;br /&gt;
&lt;br /&gt;
Due to the [http://en.wikipedia.org/wiki/Pigeonhole_principle pigeonhole principle], it is obvious that for &amp;lt;math&amp;gt;m&amp;gt;365&amp;lt;/math&amp;gt;, there must be two students with the same birthday. Surprisingly, for any &amp;lt;math&amp;gt;m&amp;gt;57&amp;lt;/math&amp;gt; this event occurs with more than 99% probability. This is called the [http://en.wikipedia.org/wiki/Birthday_problem &#039;&#039;&#039;birthday paradox&#039;&#039;&#039;]. Despite the name, the birthday paradox is not a real paradox.&lt;br /&gt;
&lt;br /&gt;
We can model this problem as a balls-into-bins problem. &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; different balls (students) are uniformly and independently thrown into 365 bins (days). More generally, let &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; be the number of bins. We ask for the probability of the following event &amp;lt;math&amp;gt;\mathcal{E}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathcal{E}&amp;lt;/math&amp;gt;: there is no bin with more than one balls (i.e. no two students share birthday).&lt;br /&gt;
&lt;br /&gt;
We first analyze this by counting. There are totally &amp;lt;math&amp;gt;n^m&amp;lt;/math&amp;gt; ways of assigning &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; balls to &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; bins. The number of assignments that no two balls share a bin is &amp;lt;math&amp;gt;{n\choose m}m!&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Thus the probability is given by:&lt;br /&gt;
:&amp;lt;math&amp;gt;\begin{align}&lt;br /&gt;
\Pr[\mathcal{E}]&lt;br /&gt;
=&lt;br /&gt;
\frac{{n\choose m}m!}{n^m}.&lt;br /&gt;
\end{align}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Recall that &amp;lt;math&amp;gt;{n\choose m}=\frac{n!}{(n-m)!m!}&amp;lt;/math&amp;gt;. Then &lt;br /&gt;
:&amp;lt;math&amp;gt;\begin{align}&lt;br /&gt;
\Pr[\mathcal{E}]&lt;br /&gt;
=&lt;br /&gt;
\frac{{n\choose m}m!}{n^m}&lt;br /&gt;
=&lt;br /&gt;
\frac{n!}{n^m(n-m)!}&lt;br /&gt;
=&lt;br /&gt;
\frac{n}{n}\cdot\frac{n-1}{n}\cdot\frac{n-2}{n}\cdots\frac{n-(m-1)}{n}&lt;br /&gt;
=&lt;br /&gt;
\prod_{k=1}^{m-1}\left(1-\frac{k}{n}\right).&lt;br /&gt;
\end{align}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is also a more &amp;quot;probabilistic&amp;quot; argument for the above equation. Consider again that &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; students are mapped to &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; possible birthdays uniformly at random.&lt;br /&gt;
&lt;br /&gt;
The first student has a birthday for sure. The probability that the second student has a different birthday from the first student is &amp;lt;math&amp;gt;\left(1-\frac{1}{n}\right)&amp;lt;/math&amp;gt;. Given that the first two students have different birthdays, the probability that the third student has a different birthday from the first two students is &amp;lt;math&amp;gt;\left(1-\frac{2}{n}\right)&amp;lt;/math&amp;gt;. Continuing this on, assuming that the first &amp;lt;math&amp;gt;k-1&amp;lt;/math&amp;gt; students all have different birthdays, the probability that the &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt;th student has a different birthday than the first &amp;lt;math&amp;gt;k-1&amp;lt;/math&amp;gt;, is given by &amp;lt;math&amp;gt;\left(1-\frac{k-1}{n}\right)&amp;lt;/math&amp;gt;. By the chain rule, the probability that all &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; students have different birthdays is:&lt;br /&gt;
:&amp;lt;math&amp;gt;\begin{align}&lt;br /&gt;
\Pr[\mathcal{E}]=\left(1-\frac{1}{n}\right)\cdot \left(1-\frac{2}{n}\right)\cdots \left(1-\frac{m-1}{n}\right)&lt;br /&gt;
&amp;amp;=&lt;br /&gt;
\prod_{k=1}^{m-1}\left(1-\frac{k}{n}\right),&lt;br /&gt;
\end{align}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
which is the same as what we got by the counting argument.&lt;br /&gt;
&lt;br /&gt;
[[File:Birthday.png|border|450px|right]]&lt;br /&gt;
&lt;br /&gt;
There are several ways of analyzing this formular. Here is a convenient one: Due to [http://en.wikipedia.org/wiki/Taylor_series Taylor&#039;s expansion], &amp;lt;math&amp;gt;e^{-k/n}\approx 1-k/n&amp;lt;/math&amp;gt;. Then&lt;br /&gt;
:&amp;lt;math&amp;gt;\begin{align}&lt;br /&gt;
\prod_{k=1}^{m-1}\left(1-\frac{k}{n}\right)&lt;br /&gt;
&amp;amp;\approx&lt;br /&gt;
\prod_{k=1}^{m-1}e^{-\frac{k}{n}}\\&lt;br /&gt;
&amp;amp;=&lt;br /&gt;
\exp\left(-\sum_{k=1}^{m-1}\frac{k}{n}\right)\\&lt;br /&gt;
&amp;amp;=&lt;br /&gt;
e^{-m(m-1)/2n}\\&lt;br /&gt;
&amp;amp;\approx&lt;br /&gt;
e^{-m^2/2n}.&lt;br /&gt;
\end{align}&amp;lt;/math&amp;gt;&lt;br /&gt;
The quality of this approximation is shown in the Figure.&lt;br /&gt;
&lt;br /&gt;
Therefore, for &amp;lt;math&amp;gt;m=\sqrt{2n\ln \frac{1}{\epsilon}}&amp;lt;/math&amp;gt;, the probability that &amp;lt;math&amp;gt;\Pr[\mathcal{E}]\approx\epsilon&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Universal Hashing ==&lt;br /&gt;
Hashing is one of the oldest tools in Computer Science. Knuth&#039;s memorandum in 1963 on analysis of hash tables is now considered to be the birth of the area of analysis of algorithms.&lt;br /&gt;
* Knuth. Notes on &amp;quot;open&amp;quot; addressing, July 22 1963. Unpublished memorandum.&lt;br /&gt;
&lt;br /&gt;
The idea of hashing is simple: an unknown set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; data &#039;&#039;&#039;items&#039;&#039;&#039; (or keys) are drawn from a large &#039;&#039;&#039;universe&#039;&#039;&#039; &amp;lt;math&amp;gt;U=[N]&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;N\gg n&amp;lt;/math&amp;gt;; in order to store &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; in a table of &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; entries (slots), we assume a consistent mapping (called a &#039;&#039;&#039;hash function&#039;&#039;&#039;) from the universe &amp;lt;math&amp;gt;U&amp;lt;/math&amp;gt; to a small range &amp;lt;math&amp;gt;[M]&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
This idea seems clever: we use a consistent mapping to deal with an arbitrary unknown data set. However, there is a fundamental flaw for hashing.&lt;br /&gt;
* For sufficiently large universe (&amp;lt;math&amp;gt;N&amp;gt; M(n-1)&amp;lt;/math&amp;gt;), for any function, there exists a bad data set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;, such that all items in &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; are mapped to the same entry in the table.&lt;br /&gt;
&lt;br /&gt;
A simple use of pigeonhole principle can prove the above statement. &lt;br /&gt;
&lt;br /&gt;
To overcome this situation, randomization is introduced into hashing. We assume that the hash function is a random mapping from &amp;lt;math&amp;gt;[N]&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;[M]&amp;lt;/math&amp;gt;. In order to ease the analysis, the following ideal assumption is used:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Simple Uniform Hash Assumption&#039;&#039;&#039; (&#039;&#039;&#039;SUHA&#039;&#039;&#039; or &#039;&#039;&#039;UHA&#039;&#039;&#039;, a.k.a. the random oracle model): &lt;br /&gt;
:A &#039;&#039;uniform&#039;&#039; random function &amp;lt;math&amp;gt;h:[N]\rightarrow[M]&amp;lt;/math&amp;gt; is available and the computation of &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; is efficient.&lt;br /&gt;
&lt;br /&gt;
=== Families of universal hash functions ===&lt;br /&gt;
The assumption of completely random function simplifies the analysis.  However, in practice, truly uniform random hash function is extremely expensive to compute and store. Thus, this simple assumption can hardly represent the reality.&lt;br /&gt;
&lt;br /&gt;
There are two approaches for implementing practical hash functions. One is to use &#039;&#039;ad hoc&#039;&#039; implementations and wish they may work. The other approach is to construct class of hash functions which are efficient to compute and store but with weaker randomness guarantees, and then analyze the applications of hash functions based on this weaker assumption of randomness.&lt;br /&gt;
&lt;br /&gt;
This route was took by Carter and Wegman in 1977 while they introduced universal families of hash functions.&lt;br /&gt;
&lt;br /&gt;
{{Theorem&lt;br /&gt;
|Definition (universal hash families)|&lt;br /&gt;
:Let &amp;lt;math&amp;gt;[N]&amp;lt;/math&amp;gt; be a universe with &amp;lt;math&amp;gt;N\ge M&amp;lt;/math&amp;gt;. A family of hash functions &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;[N]&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;[M]&amp;lt;/math&amp;gt; is said to be &#039;&#039;&#039;&amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt;-universal&#039;&#039;&#039; if, for any distinct items &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_k\in [N]&amp;lt;/math&amp;gt; and for a hash function &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; chosen uniformly at random from &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt;, we have &lt;br /&gt;
::&amp;lt;math&amp;gt;&lt;br /&gt;
\Pr[h(x_1)=h(x_2)=\cdots=h(x_k)]\le\frac{1}{M^{k-1}}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:A family of hash functions &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;[N]&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;[M]&amp;lt;/math&amp;gt; is said to be &#039;&#039;&#039;strongly &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt;-universal&#039;&#039;&#039; if, for any distinct items &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_k\in [N]&amp;lt;/math&amp;gt;, any values &amp;lt;math&amp;gt;y_1,y_2,\ldots,y_k\in[M]&amp;lt;/math&amp;gt;, and for a hash function &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; chosen uniformly at random from &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt;, we have &lt;br /&gt;
::&amp;lt;math&amp;gt;&lt;br /&gt;
\Pr[h(x_1)=y_1\wedge h(x_2)=y_2 \wedge \cdots \wedge h(x_k)=y_k]=\frac{1}{M^{k}}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
In particular, for a 2-universal family &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt;, for any distinct elements &amp;lt;math&amp;gt;x_1,x_2\in[N]&amp;lt;/math&amp;gt;, a uniform random &amp;lt;math&amp;gt;h\in\mathcal{H}&amp;lt;/math&amp;gt; has&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\Pr[h(x_1)=h(x_2)]\le\frac{1}{M}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
For a strongly 2-universal family &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt;, for any distinct elements &amp;lt;math&amp;gt;x_1,x_2\in[N]&amp;lt;/math&amp;gt; and any values &amp;lt;math&amp;gt;y_1,y_2\in[M]&amp;lt;/math&amp;gt;, a uniform random &amp;lt;math&amp;gt;h\in\mathcal{H}&amp;lt;/math&amp;gt; has&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\Pr[h(x_1)=y_1\wedge h(x_2)=y_2]=\frac{1}{M^2}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
This behavior is exactly the same as uniform random hash functions on any distinct pair of inputs. For this reason, a strongly 2-universal hash family are also called pairwise independent hash functions.&lt;br /&gt;
&lt;br /&gt;
=== 2-universal hash families ===&lt;br /&gt;
&lt;br /&gt;
The construction of pairwise independent random variables via modulo a prime introduced in Section 1 already provides a way of constructing a strongly 2-universal hash family.&lt;br /&gt;
&lt;br /&gt;
Let &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; be a prime. The function &amp;lt;math&amp;gt;h_{a,b}:[p]\rightarrow [p]&amp;lt;/math&amp;gt; is defined by&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
h_{a,b}(x)=(ax+b)\bmod p,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
and the family is&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{H}=\{h_{a,b}\mid a,b\in[p]\}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Theorem&lt;br /&gt;
|Lemma|&lt;br /&gt;
:&amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt; is strongly 2-universal.&lt;br /&gt;
}}&lt;br /&gt;
{{Proof| In Section 1, we have proved the pairwise independence of the sequence of &amp;lt;math&amp;gt;(a i+b)\bmod p&amp;lt;/math&amp;gt;, for &amp;lt;math&amp;gt;i=0,1,\ldots, p-1&amp;lt;/math&amp;gt;, which directly implies that &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt; is strongly 2-universal.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
;The original construction of Carter-Wegman&lt;br /&gt;
What if we want to have hash functions from &amp;lt;math&amp;gt;[N]&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;[M]&amp;lt;/math&amp;gt; for non-prime &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;? Carter and Wegman developed the following method.&lt;br /&gt;
&lt;br /&gt;
Suppose that the universe is &amp;lt;math&amp;gt;[N]&amp;lt;/math&amp;gt;, and the functions map &amp;lt;math&amp;gt;[N]&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;[M]&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;N\ge M&amp;lt;/math&amp;gt;. For some prime &amp;lt;math&amp;gt;p\ge N&amp;lt;/math&amp;gt;, let&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
h_{a,b}(x)=((ax+b)\bmod p)\bmod M,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
and the family&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{H}=\{h_{a,b}\mid 1\le a\le p-1, b\in[p]\}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
Note that unlike the first construction, now &amp;lt;math&amp;gt;a\neq 0&amp;lt;/math&amp;gt;.&lt;br /&gt;
{{Theorem&lt;br /&gt;
|Lemma (Carter-Wegman)|&lt;br /&gt;
:&amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt; is 2-universal.&lt;br /&gt;
}}&lt;br /&gt;
{{Proof| Due to the definition of &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt;, there are &amp;lt;math&amp;gt;p(p-1)&amp;lt;/math&amp;gt; many different hash functions in &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt;, because each hash function in &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt; corresponds to a pair of &amp;lt;math&amp;gt;1\le a\le p-1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;b\in[p]&amp;lt;/math&amp;gt;. We only need to count for any particular pair of &amp;lt;math&amp;gt;x_1,x_2\in[N]&amp;lt;/math&amp;gt; that &amp;lt;math&amp;gt;x_1\neq x_2&amp;lt;/math&amp;gt;, the number of hash functions that &amp;lt;math&amp;gt;h(x_1)=h(x_2)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We first note that for any &amp;lt;math&amp;gt;x_1\neq x_2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a x_1+b\not\equiv a x_2+b \pmod p&amp;lt;/math&amp;gt;. This is because &amp;lt;math&amp;gt;a x_1+b\equiv a x_2+b \pmod p&amp;lt;/math&amp;gt; would imply that &amp;lt;math&amp;gt;a(x_1-x_2)\equiv 0\pmod p&amp;lt;/math&amp;gt;, which can never happen since &amp;lt;math&amp;gt;1\le a\le p-1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;x_1\neq x_2&amp;lt;/math&amp;gt; (note that &amp;lt;math&amp;gt;x_1,x_2\in[N]&amp;lt;/math&amp;gt; for an &amp;lt;math&amp;gt;N\le p&amp;lt;/math&amp;gt;).  Therefore, we can assume that &amp;lt;math&amp;gt;(a x_1+b)\bmod p=u&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;(a x_2+b)\bmod p=v&amp;lt;/math&amp;gt; for &amp;lt;math&amp;gt;u\neq v&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
By linear algebra (over finite field), for any &amp;lt;math&amp;gt;x_1,x_2\in[N]&amp;lt;/math&amp;gt; that &amp;lt;math&amp;gt;x_1\neq x_2&amp;lt;/math&amp;gt;, for any &amp;lt;math&amp;gt;u,v\in[p]&amp;lt;/math&amp;gt; that &amp;lt;math&amp;gt;u\neq v&amp;lt;/math&amp;gt;, there is exact one solution to &amp;lt;math&amp;gt;(a,b)&amp;lt;/math&amp;gt; satisfying:&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{cases}&lt;br /&gt;
a x_1+b \equiv u \pmod p\\&lt;br /&gt;
a x_2+b \equiv v \pmod p.&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
After modulo &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;, every &amp;lt;math&amp;gt;u\in[p]&amp;lt;/math&amp;gt; has at most &amp;lt;math&amp;gt;\lceil p/M\rceil -1&amp;lt;/math&amp;gt; many &amp;lt;math&amp;gt;v\in[p]&amp;lt;/math&amp;gt; that &amp;lt;math&amp;gt;v\neq u&amp;lt;/math&amp;gt; but &amp;lt;math&amp;gt;v\equiv u\pmod M&amp;lt;/math&amp;gt;. Therefore, for every pair of &amp;lt;math&amp;gt;x_1,x_2\in[N]&amp;lt;/math&amp;gt; that &amp;lt;math&amp;gt;x_1\neq x_2&amp;lt;/math&amp;gt;, there exist at most &amp;lt;math&amp;gt;p(\lceil p/M\rceil -1)\le p(p-1)/M&amp;lt;/math&amp;gt; pairs of &amp;lt;math&amp;gt;1\le a\le p-1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;b\in[p]&amp;lt;/math&amp;gt; such that &amp;lt;math&amp;gt;((ax_1+b)\bmod p)\bmod M=((ax_2+b)\bmod p)\bmod M&amp;lt;/math&amp;gt;, which means there are at most &amp;lt;math&amp;gt; p(p-1)/M&amp;lt;/math&amp;gt; many hash functions &amp;lt;math&amp;gt;h\in\mathcal{H}&amp;lt;/math&amp;gt; having &amp;lt;math&amp;gt;h(x_1)=h(x_2)&amp;lt;/math&amp;gt; for &amp;lt;math&amp;gt;x_1\neq x_2&amp;lt;/math&amp;gt;. For &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; uniformly chosen from &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt;, for any &amp;lt;math&amp;gt;x_1\neq x_2&amp;lt;/math&amp;gt;,&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\Pr[h(x_1)=h(x_2)]\le \frac{p(p-1)/M}{p(p-1)}=\frac{1}{M}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
We prove that &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt; is 2-universal.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
;A construction used in practice&lt;br /&gt;
The main issue of Carter-Wegman construction is the efficiency. The mod operation is very slow, and has been so for more than 30 years.&lt;br /&gt;
&lt;br /&gt;
The following construction is due to Dietzfelbinger &#039;&#039;et al&#039;&#039;. It was published in 1997 and has been practically used in various applications of universal hashing.&lt;br /&gt;
&lt;br /&gt;
The family of hash functions is from &amp;lt;math&amp;gt;[2^u]&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;[2^v]&amp;lt;/math&amp;gt;. With a binary representation, the functions map binary strings of length &amp;lt;math&amp;gt;u&amp;lt;/math&amp;gt; to binary strings of length &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt;.&lt;br /&gt;
Let&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
h_{a}(x)=\left\lfloor\frac{a\cdot x\bmod 2^u}{2^{u-v}}\right\rfloor,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
and the family&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{H}=\{h_{a}\mid a\in[2^v]\mbox{ and }a\mbox{ is odd}\}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This family of hash functions does not exactly meet the requirement of 2-universal family. However,  Dietzfelbinger &#039;&#039;et al&#039;&#039; proved that &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt; is close to a 2-universal family. Specifically, for any distinct input values &amp;lt;math&amp;gt;x_1,x_2\in[2^u]&amp;lt;/math&amp;gt;, for a uniformly random &amp;lt;math&amp;gt;h\in\mathcal{H}&amp;lt;/math&amp;gt;,&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\Pr[h(x_1)=h(x_2)]\le\frac{1}{2^{v-1}}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
So &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt; is within an approximation ratio of 2 to being 2-universal. The proof uses the fact that odd numbers are relative prime to a power of 2.&lt;br /&gt;
&lt;br /&gt;
The function is extremely simple to compute in c language.&lt;br /&gt;
We exploit that C-multiplication (*) of unsigned u-bit numbers is done &amp;lt;math&amp;gt;\bmod 2^u&amp;lt;/math&amp;gt;, and have a one-line C-code for computing the hash function:&lt;br /&gt;
 h_a(x) = (a*x)&amp;gt;&amp;gt;(u-v)&lt;br /&gt;
The bit-wise shifting is a lot faster than modular. It explains the popularity of this scheme in practice than the original Carter-Wegman construction.&lt;br /&gt;
&lt;br /&gt;
== Collision number ==&lt;br /&gt;
Consider a 2-universal family &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt; of hash functions from &amp;lt;math&amp;gt;[N]&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;[M]&amp;lt;/math&amp;gt;. Let &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; be a hash function chosen uniformly from &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt;. For a fixed set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; distinct elements from &amp;lt;math&amp;gt;[N]&amp;lt;/math&amp;gt;, say &amp;lt;math&amp;gt;S=\{x_1,x_2,\ldots,x_n\}&amp;lt;/math&amp;gt;, the elements are mapped to the hash values &amp;lt;math&amp;gt;h(x_1), h(x_2), \ldots, h(x_n)&amp;lt;/math&amp;gt;. This can be seen as throwing &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; balls to &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; bins, with pairwise independent choices of bins.&lt;br /&gt;
&lt;br /&gt;
As in the balls-into-bins with full independence, we are curious about the questions such as the birthday problem or the maximum load. These questions are interesting not only because they are natural to ask in a balls-into-bins setting, but in the context of hashing, they are closely related to the performance of hash functions.&lt;br /&gt;
&lt;br /&gt;
The old techniques for analyzing balls-into-bins rely too much on the independence of the choice of the bin for each ball, therefore can hardly be extended to the setting of 2-universal hash families. However, it turns out several balls-into-bins questions can somehow be answered by analyzing a very natural quantity: the number of &#039;&#039;&#039;collision pairs&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A collision pair for hashing is a pair of elements &amp;lt;math&amp;gt;x_1,x_2\in S&amp;lt;/math&amp;gt; which are mapped to the same hash value, i.e. &amp;lt;math&amp;gt;h(x_1)=h(x_2)&amp;lt;/math&amp;gt;. Formally, for a fixed set of elements &amp;lt;math&amp;gt;S=\{x_1,x_2,\ldots,x_n\}&amp;lt;/math&amp;gt;, for any &amp;lt;math&amp;gt;1\le i,j\le n&amp;lt;/math&amp;gt;, let the random variable&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
X_{ij}&lt;br /&gt;
=&lt;br /&gt;
\begin{cases}&lt;br /&gt;
1 &amp;amp; \text{if }h(x_i)=h(x_j),\\&lt;br /&gt;
0 &amp;amp; \text{otherwise.}&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
The total number of collision pairs among the &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; items &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_n&amp;lt;/math&amp;gt; is &lt;br /&gt;
:&amp;lt;math&amp;gt;X=\sum_{i&amp;lt;j} X_{ij}.\,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt; is 2-universal, for any &amp;lt;math&amp;gt;i\neq j&amp;lt;/math&amp;gt;,&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\Pr[X_{ij}=1]=\Pr[h(x_i)=h(x_j)]\le\frac{1}{M}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The expected number of collision pairs is &lt;br /&gt;
:&amp;lt;math&amp;gt;\mathbf{E}[X]=\mathbf{E}\left[\sum_{i&amp;lt;j}X_{ij}\right]=\sum_{i&amp;lt;j}\mathbf{E}[X_{ij}]=\sum_{i&amp;lt;j}\Pr[X_{ij}=1]\le{n\choose 2}\frac{1}{M}&amp;lt;\frac{n^2}{2M}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In particular, for &amp;lt;math&amp;gt;n=M&amp;lt;/math&amp;gt;, i.e. &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; items are mapped to &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; hash values by a pairwise independent hash function, the expected collision number is &amp;lt;math&amp;gt;\mathbf{E}[X]&amp;lt;\frac{n^2}{2M}=\frac{n}{2}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The above analysis gives us an estimation on the expected number of collision pairs, such that &amp;lt;math&amp;gt;\mathbf{E}[X]&amp;lt;\frac{n^2}{2M}&amp;lt;/math&amp;gt;. Apply the Markov&#039;s inequality, for &amp;lt;math&amp;gt;0&amp;lt;\epsilon&amp;lt;1&amp;lt;/math&amp;gt;, we have&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\Pr\left[X\ge \frac{n^2}{2\epsilon M}\right]\le\Pr\left[X\ge \frac{1}{\epsilon}\mathbf{E}[X]\right]\le\epsilon.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;n\le\sqrt{2\epsilon M}&amp;lt;/math&amp;gt;, the number of collision pairs is &amp;lt;math&amp;gt;X\ge1&amp;lt;/math&amp;gt; with probability at most &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;, therefore with probability at least &amp;lt;math&amp;gt;1-\epsilon&amp;lt;/math&amp;gt;, there is no collision at all. Therefore, we have the following theorem.&lt;br /&gt;
{{Theorem&lt;br /&gt;
|Theorem|&lt;br /&gt;
:If &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; is chosen uniformly from a 2-universal family of hash functions mapping the universe &amp;lt;math&amp;gt;[N]&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;[M]&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;N\ge M&amp;lt;/math&amp;gt;, then for any set &amp;lt;math&amp;gt;S\subset [N]&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; items, where &amp;lt;math&amp;gt;n\le\sqrt{2\epsilon M}&amp;lt;/math&amp;gt;, the probability that there exits a collision pair is&lt;br /&gt;
::&amp;lt;math&amp;gt;&lt;br /&gt;
\Pr[\mbox{collision occurs}]\le\epsilon.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Recall that for mutually independent choices of bins, for some &amp;lt;math&amp;gt;n=\sqrt{2M\ln(1/\epsilon)}&amp;lt;/math&amp;gt;, the probability that a collision occurs is about &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;. For constant &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;, this gives an essentially same bound as the pairwise independent setting. Therefore, &lt;br /&gt;
the behavior of pairwise independent hash function is essentially the same as the uniform random hash function for the birthday problem. This is easy to understand, because birthday problem is about the behavior of collisions, and the definition of 2-universal hash function can be interpreted as &amp;quot;functions that the probability of collision is as low as a uniform random function&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
= Set  Membership=&lt;br /&gt;
A basic question in Computer Science is:&lt;br /&gt;
:&amp;quot;&amp;lt;math&amp;gt;\mbox{Is }x\in S?&amp;lt;/math&amp;gt;&amp;quot;&lt;br /&gt;
for a set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; and an element &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt;. This is the &#039;&#039;&#039;set membership&#039;&#039;&#039; problem.&lt;br /&gt;
&lt;br /&gt;
Formally, given an arbitrary set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; elements from a universe &amp;lt;math&amp;gt;U&amp;lt;/math&amp;gt;, we want to use a succinct &#039;&#039;&#039;data structure&#039;&#039;&#039; to represent this set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;, so that upon each &#039;&#039;&#039;query&#039;&#039;&#039; of any element &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; from the universe &amp;lt;math&amp;gt;[N]&amp;lt;/math&amp;gt;, the question of whether &amp;lt;math&amp;gt;x\in S&amp;lt;/math&amp;gt; is efficiently answered. The complexity of such data structure is measured in two-fold:&lt;br /&gt;
* &#039;&#039;&#039;space cost&#039;&#039;&#039;: size of the data structure to represent a set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; of size &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;;&lt;br /&gt;
* &#039;&#039;&#039;time cost&#039;&#039;&#039;: time complexity of answering each query by accessing to the data structure.&lt;br /&gt;
&lt;br /&gt;
Suppose that the universe &amp;lt;math&amp;gt;U&amp;lt;/math&amp;gt; is of size &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;. Clearly, the membership problem can be solved by a &#039;&#039;&#039;dictionary data structure&#039;&#039;&#039;, e.g.:&lt;br /&gt;
* &#039;&#039;&#039;sorted table / balanced search tree&#039;&#039;&#039;: with space cost &amp;lt;math&amp;gt;O(n\log N)&amp;lt;/math&amp;gt; bits and time cost &amp;lt;math&amp;gt;O(\log n)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Note that &amp;lt;math&amp;gt;\log{N\choose n}=\Theta\left(n\log \frac{N}{n}\right)&amp;lt;/math&amp;gt; is the entropy of sets &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; elements from a universe &amp;lt;math&amp;gt;U&amp;lt;/math&amp;gt; of size &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;. Therefore it is necessary to use so many bits to represent a set without losing any information. &lt;br /&gt;
With hashing, we can solve this fundamental problem with asymptotic optimal space cost and time cost at the same time.&lt;br /&gt;
&lt;br /&gt;
== Perfect hashing using quadratic space==&lt;br /&gt;
The idea of perfect hashing is that we use a hash function &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; to map the &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; items to distinct entries of the table; store every item &amp;lt;math&amp;gt;x\in S&amp;lt;/math&amp;gt; in the entry &amp;lt;math&amp;gt;h(x)&amp;lt;/math&amp;gt;; and also store the hash function &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; in a fixed location in the table (usually the beginning of the table). The algorithm for searching for an item is as follows:&lt;br /&gt;
&lt;br /&gt;
:search for &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; in table &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;:&lt;br /&gt;
# retrieve &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; from a fixed location in the table;&lt;br /&gt;
# if &amp;lt;math&amp;gt;x=T[h(x)]&amp;lt;/math&amp;gt; return &amp;lt;math&amp;gt;h(x)&amp;lt;/math&amp;gt;; else return NOT_FOUND;&lt;br /&gt;
&lt;br /&gt;
This scheme works as long as that the hash function satisfies the following two conditions:&lt;br /&gt;
* The description of &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; is sufficiently short, so that &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; can be stored in one entry (or in constant many entries) of the table.&lt;br /&gt;
* &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; has no collisions on &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;, i.e. there is no pair of items &amp;lt;math&amp;gt;x_1,x_2\in S&amp;lt;/math&amp;gt; that are mapped to the same value by &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The first condition is easy to guarantee for 2-universal hash families. As shown by Carter-Wegman construction, a 2-universal hash function can be uniquely represented by two integers &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt;, which can be stored in two entries (or just one, if the word length is sufficiently large) of the table.&lt;br /&gt;
&lt;br /&gt;
Our discussion is now focused on the second condition. We find that it relies on the &#039;&#039;perfectness&#039;&#039; of the hash function for a data set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
A hash function &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; is &#039;&#039;&#039;perfect&#039;&#039;&#039; for a set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; of items if &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; maps all items in &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; to different values, i.e. there is no collision.&lt;br /&gt;
&lt;br /&gt;
We have shown by the birthday problem for 2-universal hashing that when &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; items are mapped to &amp;lt;math&amp;gt;n^2&amp;lt;/math&amp;gt; values, for an &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; chosen uniformly from a 2-universal family of hash functions, the probability that a collision occurs is at most 1/2. Thus&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\Pr[h\mbox{ is perfect for }S]\ge\frac{1}{2}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
for a table of &amp;lt;math&amp;gt;n^2&amp;lt;/math&amp;gt; entries.&lt;br /&gt;
&lt;br /&gt;
The construction of perfect hashing is straightforward then:&lt;br /&gt;
:For a set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; elements:&lt;br /&gt;
# uniformly choose an &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; from a 2-universal family &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt;; (for Carter-Wegman&#039;s construction, it means uniformly choose two integer &amp;lt;math&amp;gt;1\le a\le p-1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;b\in[p]&amp;lt;/math&amp;gt; for a sufficiently large prime &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.)&lt;br /&gt;
# check whether &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; is perfect for &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;;&lt;br /&gt;
# if &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; is NOT perfect for &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;, start over again; otherwise, construct the table;&lt;br /&gt;
&lt;br /&gt;
This is a Las Vegas randomized algorithm, which construct a perfect hashing for a fixed set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; with expectedly at most two trials (due to geometric distribution). The resulting data structure is a &amp;lt;math&amp;gt;O(n^2)&amp;lt;/math&amp;gt;-size static dictionary of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; elements which answers every search in deterministic &amp;lt;math&amp;gt;O(1)&amp;lt;/math&amp;gt; time.&lt;br /&gt;
&lt;br /&gt;
== FKS perfect hashing ==&lt;br /&gt;
In the last section we see how to use &amp;lt;math&amp;gt;O(n^2)&amp;lt;/math&amp;gt; space and constant time for answering search in a set. Now we see how to do it with linear space and constant time. This solves the problem of searching asymptotically optimal for both time and space.&lt;br /&gt;
&lt;br /&gt;
This was once seemingly impossible, until Yao&#039;s seminal paper:&lt;br /&gt;
*Yao. Should tables be sorted? &#039;&#039;Journal of the ACM (JACM)&#039;&#039;, 1981.&lt;br /&gt;
&lt;br /&gt;
Yao&#039;s paper shows a possibility of achieving linear space and constant time at the same time by exploiting the power of hashing, but assumes an unrealistically large universe. &lt;br /&gt;
&lt;br /&gt;
Inspired by Yao&#039;s work, Fredman, Komlós, and Szemerédi discover the first linear-space and constant-time static dictionary in a realistic setting: &lt;br /&gt;
* Fredman, Komlós, and Szemerédi. Storing a sparse table with O(1) worst case access time. &#039;&#039;Journal of the ACM (JACM)&#039;&#039;, 1984.&lt;br /&gt;
&lt;br /&gt;
The idea of FKS hashing is to arrange hash table in two levels:&lt;br /&gt;
* In the first level, &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; items are hashed to &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; &#039;&#039;buckets&#039;&#039; by a 2-universal hash function &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt;. &lt;br /&gt;
: Let &amp;lt;math&amp;gt;B_i&amp;lt;/math&amp;gt; be the set of items hashed to the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;th bucket.&lt;br /&gt;
* In the second level, construct a &amp;lt;math&amp;gt;|B_i|^2&amp;lt;/math&amp;gt;-size perfect hashing for each bucket &amp;lt;math&amp;gt;B_i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The data structure can be stored in a table. The first few entries are reserved to store the primary hash function &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt;. To help the searching algorithm locate a bucket, we use the next &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; entries of the table as the &amp;quot;pointers&amp;quot; to the bucket: each entry stores the address of the first entry of the space to store a bucket. In the rest of table, the &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; buckets are stored in order, each using a &amp;lt;math&amp;gt;|B_i|^2&amp;lt;/math&amp;gt; space as required by perfect hashing.&lt;br /&gt;
&lt;br /&gt;
::[[File:FKS.png|600px]]&lt;br /&gt;
&lt;br /&gt;
It is easy to see that the search time is constant. To search for an item &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt;, the algorithm does the followings:&lt;br /&gt;
* Retrieve &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt;.&lt;br /&gt;
* Retrieve the address for bucket &amp;lt;math&amp;gt;h(x)&amp;lt;/math&amp;gt;.&lt;br /&gt;
* Search by perfect hashing within bucket &amp;lt;math&amp;gt;h(x)&amp;lt;/math&amp;gt;.&lt;br /&gt;
Each line takes constant time. So the worst-case search time is constant.&lt;br /&gt;
&lt;br /&gt;
We then need to guarantee that the space is linear to &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;. At the first glance, this seems impossible because each instance of perfect hashing for a bucket costs a square-size of space. We will prove that although the individual buckets use square-sized spaces, the sum of the them is still linear.&lt;br /&gt;
&lt;br /&gt;
For a fixed set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; items, for a hash function &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; chosen uniformly from a 2-universe family which maps the items to &amp;lt;math&amp;gt;[n]&amp;lt;/math&amp;gt;, called &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; &#039;&#039;buckets&#039;&#039;,  let &amp;lt;math&amp;gt;Y_i=|B_i|&amp;lt;/math&amp;gt; be the number of items in &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; mapped to the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;th bucket.&lt;br /&gt;
We are going to bound the following quantity:&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
Y=\sum_{i=1}^n Y_i^2.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
Since each bucket &amp;lt;math&amp;gt;B_i&amp;lt;/math&amp;gt; use a space of &amp;lt;math&amp;gt;Y_i^2&amp;lt;/math&amp;gt; for perfect hashing. &amp;lt;math&amp;gt;Y&amp;lt;/math&amp;gt; gives the size of the space for storing the buckets. &lt;br /&gt;
&lt;br /&gt;
We will show that &amp;lt;math&amp;gt;Y&amp;lt;/math&amp;gt; is related to the total number of collision pairs. (Indeed, the number of collision pairs can be computed by a degree-2 polynomial, just like &amp;lt;math&amp;gt;Y&amp;lt;/math&amp;gt;.)&lt;br /&gt;
&lt;br /&gt;
Note that a bucket of &amp;lt;math&amp;gt;Y_i&amp;lt;/math&amp;gt; items contributes &amp;lt;math&amp;gt;{Y_i\choose 2}&amp;lt;/math&amp;gt; collision pairs. Let &amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt; be the total number of collision pairs.&lt;br /&gt;
&amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt; can be computed by summing over the collision pairs in every bucket:&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
X=\sum_{i=1}^n{Y_i\choose 2}=\sum_{i=1}^n\frac{Y_i(Y_i-1)}{2}=\frac{1}{2}\left(\sum_{i=1}^nY_i^2-\sum_{i=1}^nY_i\right)=\frac{1}{2}\left(\sum_{i=1}^nY_i^2-n\right).&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Therefore, the sum of squares of the sizes of buckets is related to collision number by:&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\sum_{i=1}^nY_i^2=2X+n.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
By our analysis of the collision number, we know that for &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; items mapped to &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; buckets, the expected number of collision pairs is: &amp;lt;math&amp;gt;\mathbf{E}[X]\le \frac{n}{2}&amp;lt;/math&amp;gt;.&lt;br /&gt;
Thus,&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\mathbf{E}\left[\sum_{i=1}^nY_i^2\right]=\mathbf{E}[2X+n]\le 2n.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
Due to Markov&#039;s inequality, &amp;lt;math&amp;gt;\sum_{i=1}^nY_i^2=O(n)&amp;lt;/math&amp;gt; with a constant probability. For any set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;, we can find a suitable &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; after expected constant number of trials, and FKS can be constructed with guaranteed (instead of expected) linear-size which answers each search in constant time.&lt;br /&gt;
&lt;br /&gt;
== Bloom filter ==&lt;br /&gt;
Now we consider the lossy representation of the original data set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;, to further save the space usage. Such lossy data structure is sometimes called a &#039;&#039;&#039;&#039;&#039;sketch&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The Bloom filter is such a lossy data structure. It is a space-efficient hash table that solves the &#039;&#039;&#039;approximate membership&#039;&#039;&#039; problem with one-sided error (&#039;&#039;false positive&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
Given a set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; elements from a universe &amp;lt;math&amp;gt;U&amp;lt;/math&amp;gt;, a Bloom filter consists of an array &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;cn&amp;lt;/math&amp;gt; bits, and &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; hash functions &amp;lt;math&amp;gt;h_1,h_2,\ldots,h_k&amp;lt;/math&amp;gt; map &amp;lt;math&amp;gt;U&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;[cn]&amp;lt;/math&amp;gt;, where both &amp;lt;math&amp;gt;c&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; are parameters that we can try to optimize later.&lt;br /&gt;
&lt;br /&gt;
As before, we assume the &#039;&#039;&#039;Uniform Hash Assumption (UHA)&#039;&#039;&#039;: &amp;lt;math&amp;gt;h_1,h_2,\ldots,h_k&amp;lt;/math&amp;gt; are mutually independent hash function where each &amp;lt;math&amp;gt;h_i&amp;lt;/math&amp;gt; is a uniform random hash function &amp;lt;math&amp;gt;h_i:U\to[cn]&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The Bloom filter works as follows:&lt;br /&gt;
{{Theorem|&#039;&#039;Bloom filter&#039;&#039; (Bloom 1970)|&lt;br /&gt;
:Suppose &amp;lt;math&amp;gt;h_1,h_2,\ldots,h_k:U\to[cn]&amp;lt;/math&amp;gt; are uniform and independent random hash functions.&lt;br /&gt;
-----&lt;br /&gt;
:&#039;&#039;&#039;Data structure construction:&#039;&#039;&#039; Given a set &amp;lt;math&amp;gt;S\subset U&amp;lt;/math&amp;gt; of size &amp;lt;math&amp;gt;n=|S|&amp;lt;/math&amp;gt;, the data structure is a Boolean array &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;cn&amp;lt;/math&amp;gt; bits constructed as&lt;br /&gt;
:* initialize all &amp;lt;math&amp;gt;cn&amp;lt;/math&amp;gt; bits of the Boolean array &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; to 0;&lt;br /&gt;
:* for each &amp;lt;math&amp;gt;x\in S&amp;lt;/math&amp;gt;, let &amp;lt;math&amp;gt;A[h_i(x)]=1&amp;lt;/math&amp;gt; for all &amp;lt;math&amp;gt;1\le i\le k&amp;lt;/math&amp;gt;.&lt;br /&gt;
----&lt;br /&gt;
:&#039;&#039;&#039;Query resolution:&#039;&#039;&#039; Upon each query of an arbitrary &amp;lt;math&amp;gt;x\in U&amp;lt;/math&amp;gt;,&lt;br /&gt;
:* answer &amp;quot;yes&amp;quot; if &amp;lt;math&amp;gt;A[h_i(x)]=1&amp;lt;/math&amp;gt; for all &amp;lt;math&amp;gt;1\le i\le k&amp;lt;/math&amp;gt; and &amp;quot;no&amp;quot; if otherwise.&lt;br /&gt;
}}&lt;br /&gt;
The Boolean array is our data structure, whose size is &amp;lt;math&amp;gt;cn&amp;lt;/math&amp;gt; bits. With Uniform Hash Assumption (UHA), the time cost of the data structure for answering each query is &amp;lt;math&amp;gt;O(k)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
When the answer returned by the algorithm is &amp;quot;no&amp;quot;, it holds that &amp;lt;math&amp;gt;A[h_i(x)]=0&amp;lt;/math&amp;gt; for some &amp;lt;math&amp;gt;1\le i\le k&amp;lt;/math&amp;gt;, in which case the query &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; must not belong to the set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;. Thus, the Bloom filter has no false negatives.&lt;br /&gt;
&lt;br /&gt;
On the other hand, when the answer returned by the algorithm is &amp;quot;yes&amp;quot;, &amp;lt;math&amp;gt;A[h_i(x)]=1&amp;lt;/math&amp;gt; for all &amp;lt;math&amp;gt;1\le i\le k&amp;lt;/math&amp;gt;. It is still possible for some  &amp;lt;math&amp;gt;x\not\in S&amp;lt;/math&amp;gt; that all bits  &amp;lt;math&amp;gt;A[h_i(x)]&amp;lt;/math&amp;gt; are set by elements in &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;. We want to bound such false positive, that is, the following probability for an  &amp;lt;math&amp;gt;x\not\in S&amp;lt;/math&amp;gt;:&lt;br /&gt;
:&amp;lt;math&amp;gt;\Pr[\,\forall 1\le i\le k, A[h_i(x)]=1\,]&amp;lt;/math&amp;gt;,&lt;br /&gt;
which by independence between different hash functions and by symmetry is equal to:&lt;br /&gt;
:&amp;lt;math&amp;gt;\Pr[\, A[h_1(x)]=1\,]^k=(1-\Pr[\, A[h_1(x)]=0\,])^k&amp;lt;/math&amp;gt;.&lt;br /&gt;
For an element &amp;lt;math&amp;gt;x\not\in S&amp;lt;/math&amp;gt;, its hash value &amp;lt;math&amp;gt;h_1(x)&amp;lt;/math&amp;gt; is independent of all hash values &amp;lt;math&amp;gt;h_i(y)&amp;lt;/math&amp;gt; for all &amp;lt;math&amp;gt;1\le i\le k&amp;lt;/math&amp;gt; and all &amp;lt;math&amp;gt;y\in S&amp;lt;/math&amp;gt;. This is due to the Uniform Hash Assumption. The hash value &amp;lt;math&amp;gt;h_1(x)&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;x\not\in S&amp;lt;/math&amp;gt; is then independent of the content of the array &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt;. Therefore, the probability of this position &amp;lt;math&amp;gt;A[h_1(x)]&amp;lt;/math&amp;gt; missed by all &amp;lt;math&amp;gt;kn&amp;lt;/math&amp;gt; updates to the Boolean array &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; caused by all &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; elements in &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; is:&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\Pr[\, A[h_1(x)]=0\,]=\left(1-\frac{1}{cn}\right)^{kn}\approx e^{-k/c}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Putting everything together, for any &amp;lt;math&amp;gt;x\not\in S&amp;lt;/math&amp;gt;, the false positive is bounded as:&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{align}&lt;br /&gt;
\Pr[\,\text{wrongly answer &#039;&#039;yes&#039;&#039;}\,]&lt;br /&gt;
&amp;amp;=\Pr[\,\forall 1\le i\le k, A[h_i(x)]=1\,]\\&lt;br /&gt;
&amp;amp;=\Pr[\, A[h_1(x)]=1\,]^k=(1-\Pr[\, A[h_1(x)]=0\,])^k\\&lt;br /&gt;
&amp;amp;=\left(1-\left(1-\frac{1}{cn}\right)^{kn}\right)^k\\&lt;br /&gt;
&amp;amp;\approx \left(1- e^{-k/c}\right)^k&lt;br /&gt;
\end{align}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
which is &amp;lt;math&amp;gt;(0.6185)^c&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;k=c\ln 2&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Bloom filter solves the membership query with a small constant error of false positives using a data structure of &amp;lt;math&amp;gt;O(n)&amp;lt;/math&amp;gt; bits which answers each query with &amp;lt;math&amp;gt;O(1)&amp;lt;/math&amp;gt; time cost.&lt;br /&gt;
&lt;br /&gt;
=Distinct Elements=&lt;br /&gt;
Consider the following problem of &#039;&#039;&#039;counting distinct elements&#039;&#039;&#039;: Suppose that &amp;lt;math&amp;gt;U&amp;lt;/math&amp;gt; is a sufficiently large universe.&lt;br /&gt;
*&#039;&#039;&#039;Input:&#039;&#039;&#039; a sequence of (not necessarily distinct) elements &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_n\in U&amp;lt;/math&amp;gt;;&lt;br /&gt;
*&#039;&#039;&#039;Output:&#039;&#039;&#039; an estimation of the total number of distinct elements &amp;lt;math&amp;gt;z=|\{x_1,x_2,\ldots,x_n\}|&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
A straightforward way of solving this problem is to maintain a dictionary data structure, which costs at least linear (&amp;lt;math&amp;gt;O(n)&amp;lt;/math&amp;gt;) space. For &#039;&#039;big data&#039;&#039;, where &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is very large, this is still too expensive. However, due to an information-theoretical argument, linear space is necessary if you want to compute the &#039;&#039;exact&#039;&#039; value of &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Our goal is to relax the problem a little bit to significantly reduce the space cost by tolerating &#039;&#039;approximate&#039;&#039; answers. The form of approximation we consider is &#039;&#039;&#039;&amp;lt;math&amp;gt;(\epsilon,\delta)&amp;lt;/math&amp;gt;-estimator&#039;&#039;&#039;.&lt;br /&gt;
{{Theorem|&amp;lt;math&amp;gt;(\epsilon,\delta)&amp;lt;/math&amp;gt;-estimator|&lt;br /&gt;
: A random variable &amp;lt;math&amp;gt;\widehat{Z}&amp;lt;/math&amp;gt; is an &#039;&#039;&#039;&amp;lt;math&amp;gt;(\epsilon,\delta)&amp;lt;/math&amp;gt;-estimator&#039;&#039;&#039; of a quantity &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; if&lt;br /&gt;
::&amp;lt;math&amp;gt;\Pr[\,(1-\epsilon)z\le \widehat{Z}\le (1+\epsilon)z\,]\ge 1-\delta&amp;lt;/math&amp;gt;.&lt;br /&gt;
: &amp;lt;math&amp;gt;\widehat{Z}&amp;lt;/math&amp;gt; is said to be an &#039;&#039;&#039;unbiased estimator&#039;&#039;&#039; of &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt;\mathbb{E}[\widehat{Z}]=z&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
Usually &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; is called &#039;&#039;&#039;approximation error&#039;&#039;&#039; and &amp;lt;math&amp;gt;\delta&amp;lt;/math&amp;gt; is called &#039;&#039;&#039;confidence error&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
We now present an elegant algorithm. The algorithm can be implemented in [https://en.wikipedia.org/wiki/Streaming_algorithm &#039;&#039;&#039;data stream model&#039;&#039;&#039;]: The input elements &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_n&amp;lt;/math&amp;gt; is presented to the algorithm one at a time, where the size of data &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is unknown to the algorithm. The algorithm maintains a value &amp;lt;math&amp;gt;\widehat{Z}&amp;lt;/math&amp;gt; which is an &amp;lt;math&amp;gt;(\epsilon,\delta)&amp;lt;/math&amp;gt;-estimator of the total number of distinct elements &amp;lt;math&amp;gt;z=|\{x_1,x_2,\ldots,x_n\}|&amp;lt;/math&amp;gt;, using only a small amount of memory space to memorize (with loss) the data set &amp;lt;math&amp;gt;\{x_1,x_2,\ldots,x_n\}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
A famous quotation of Flajolet describes the performance of this algorithm as:&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;Using only memory equivalent to 5 lines of printed text, you can estimate with a typical accuracy of 5% and in a single pass the total vocabulary of Shakespeare.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== The &amp;lt;math&amp;gt;\min&amp;lt;/math&amp;gt;-sketch ==&lt;br /&gt;
Suppose that we can access to an idealized random hash function &amp;lt;math&amp;gt;h:U\to[0,1]&amp;lt;/math&amp;gt; which is uniformly distributed over all mappings from the universe &amp;lt;math&amp;gt;U&amp;lt;/math&amp;gt; to unit interval &amp;lt;math&amp;gt;[0,1]&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Recall that the input sequence &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_n\in U&amp;lt;/math&amp;gt; consists of &amp;lt;math&amp;gt;z=|\{x_1,x_2,\ldots,x_n\}|&amp;lt;/math&amp;gt; distinct elements. These elements are mapped by the random function &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; hash values uniformly and independently distributed in &amp;lt;math&amp;gt;[0,1]&amp;lt;/math&amp;gt;. We could maintain these hash values instead of the original elements, but this would still be too expensive because in the worst case we still have up to &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; distinct values to maintain. However, due to the idealized random hash function, the unit interval &amp;lt;math&amp;gt;[0,1]&amp;lt;/math&amp;gt; will be partitioned into &amp;lt;math&amp;gt;z+1&amp;lt;/math&amp;gt; subintervals by these &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; uniform and independent hash values. The typical length of the subinterval gives an estimation of the number &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{{Theorem|Proposition|&lt;br /&gt;
:&amp;lt;math&amp;gt;\mathbb{E}\left[\min_{1\le i\le n}h(x_i)\right]=\frac{1}{z+1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
{{Proof|&lt;br /&gt;
The input sequence &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_n\in U&amp;lt;/math&amp;gt; consisting of &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; distinct elements are mapped to &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; random hash values uniformly and independently distributed in &amp;lt;math&amp;gt;[0,1]&amp;lt;/math&amp;gt;. These &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; hash values partition the unit interval &amp;lt;math&amp;gt;[0,1]&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;z+1&amp;lt;/math&amp;gt; subintervals &amp;lt;math&amp;gt;[0,v_1],[v_1,v_2],[v_2,v_3]\ldots,[v_{z-1},v_z],[v_z,1]&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;v_i&amp;lt;/math&amp;gt; denotes the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th smallest value among all hash values &amp;lt;math&amp;gt;\{h(x_1),h(x_2),\ldots,h(x_n)\}&amp;lt;/math&amp;gt;. Clearly we have &lt;br /&gt;
:&amp;lt;math&amp;gt;v_1=\min_{1\le i\le n}h(x_i)&amp;lt;/math&amp;gt;. &lt;br /&gt;
Meanwhile, since all hash values are uniformly and independently distributed in &amp;lt;math&amp;gt;[0,1]&amp;lt;/math&amp;gt;, the lengths of all subintervals &amp;lt;math&amp;gt;v_1, v_2-v_1, v_3-v_2,\ldots, v_z-v_{z-1}, 1-v_z&amp;lt;/math&amp;gt; are identically distributed. By symmetry, they have the same expectation, therefore&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
(z+1)\mathbb{E}[v_1]=&lt;br /&gt;
\mathbb{E}[v_1]+\sum_{i=1}^{z-1}\mathbb{E}[v_{i+1}-v_i]+\mathbb{E}[1-v_z]&lt;br /&gt;
=\mathbb{E}\left[v_1+(v_2-v_1)+(v_3-v_2)+\cdots+(v_{z}-v_{z-1})+1-v_z\right]&lt;br /&gt;
=1,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
which implies that&lt;br /&gt;
:&amp;lt;math&amp;gt;\mathbb{E}\left[\min_{1\le i\le n}h(x_i)\right]=\mathbb{E}[v_1]=\frac{1}{z+1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The quantity &amp;lt;math&amp;gt;\min_{1\le i\le n}h(x_i)&amp;lt;/math&amp;gt; can be computed with small space cost (for storing the current smallest hash value) by scan the input sequence in a single pass. Because as we proved its expectation is &amp;lt;math&amp;gt;\frac{1}{z+1}&amp;lt;/math&amp;gt;, the smallest hash value &amp;lt;math&amp;gt;Y=\min_{1\le i\le n}h(x_i)&amp;lt;/math&amp;gt; gives an unbiased estimator for &amp;lt;math&amp;gt;\frac{1}{z+1}&amp;lt;/math&amp;gt;. However, &amp;lt;math&amp;gt;\frac{1}{Y}-1&amp;lt;/math&amp;gt; is not necessarily a good estimator for &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt;. Actually, it is a rather poor estimator. Consider for example when &amp;lt;math&amp;gt;z=1&amp;lt;/math&amp;gt;, all input elements are the same. In this case, there is only one hash value and &amp;lt;math&amp;gt;Y=\min_{1\le i\le n}h(x_i)&amp;lt;/math&amp;gt; is distributed uniformly over &amp;lt;math&amp;gt;[0,1]&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;\frac{1}{Y}-1&amp;lt;/math&amp;gt; fails to be close enough to the correct answer 1 with high probability.&lt;br /&gt;
&lt;br /&gt;
==Apply the mean trick to the &amp;lt;math&amp;gt;\min&amp;lt;/math&amp;gt;-sketch==&lt;br /&gt;
The reason that the above estimator of a single hash function performs poorly is that the unbiased estimator &amp;lt;math&amp;gt;\min_{1\le i\le n}h(x_i)&amp;lt;/math&amp;gt; has large variance. So a natural way to reduce this variance is to have multiple independent hash functions and take the average. This generic approach for reducing the variance is called &#039;&#039;&#039;the mean trick&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
Suppose that we can access to &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; independent random hash functions &amp;lt;math&amp;gt;h_1,h_2,\ldots,h_k&amp;lt;/math&amp;gt;, where each &amp;lt;math&amp;gt;h_j: U\to[0,1]&amp;lt;/math&amp;gt; is uniformly and independently distributed over all functions mapping &amp;lt;math&amp;gt;U&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;[0,1]&amp;lt;/math&amp;gt;. Here &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; is a parameter to be fixed by the desired approximation error &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; and confidence error &amp;lt;math&amp;gt;\delta&amp;lt;/math&amp;gt;. The &#039;&#039;&amp;lt;math&amp;gt;\min&amp;lt;/math&amp;gt;-sketch algorithm&#039;&#039; (using the mean trick) is given by the following pseudocode.&lt;br /&gt;
&lt;br /&gt;
{{Theorem|The &amp;lt;math&amp;gt;\min&amp;lt;/math&amp;gt;-sketch|&lt;br /&gt;
:Suppose that &amp;lt;math&amp;gt;h_1,h_2,\ldots,h_k: U\to[0,1]&amp;lt;/math&amp;gt; are &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; uniform and independent random hash functions, where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; is a parameter to be fixed later.&lt;br /&gt;
-----&lt;br /&gt;
:Scan the input sequence &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_n\in U&amp;lt;/math&amp;gt; in a single pass to compute:&lt;br /&gt;
::* &amp;lt;math&amp;gt;Y_j=\min_{1\le i\le n}h_j(x_i)&amp;lt;/math&amp;gt; for every &amp;lt;math&amp;gt;j=1,2,\ldots,k&amp;lt;/math&amp;gt;;&lt;br /&gt;
::* average value &amp;lt;math&amp;gt;\overline{Y}=\frac{1}{k}\sum_{j=1}^kY_j&amp;lt;/math&amp;gt;;&lt;br /&gt;
:return &amp;lt;math&amp;gt;\widehat{Z}=\frac{1}{\overline{Y}}-1&amp;lt;/math&amp;gt; as the estimator.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The algorithm is easy to implement in data stream model, with a space cost of storing &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; hash values. The following theorem guarantees that the algorithm returns an &amp;lt;math&amp;gt;(\epsilon,\delta)&amp;lt;/math&amp;gt;-estimator of the total number of distinct elements for a suitable &amp;lt;math&amp;gt;k=O\left(\frac{1}{\epsilon^2\delta}\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
{{Theorem|Theorem|&lt;br /&gt;
:For any &amp;lt;math&amp;gt;\epsilon,\delta&amp;lt;1/2&amp;lt;/math&amp;gt;, if &amp;lt;math&amp;gt;k\ge\left\lceil\frac{4}{\epsilon^2\delta}\right\rceil&amp;lt;/math&amp;gt; then the output &amp;lt;math&amp;gt;\widehat{Z}&amp;lt;/math&amp;gt; always gives an &amp;lt;math&amp;gt;(\epsilon,\delta)&amp;lt;/math&amp;gt;-estimator of the correct answer &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
In the following we prove this main theorem for &amp;lt;math&amp;gt;\min&amp;lt;/math&amp;gt;-sketch algorithm. &lt;br /&gt;
&lt;br /&gt;
An obstacle to analyze the estimator &amp;lt;math&amp;gt;\widehat{Z}=\frac{1}{\overline{Y}}-1&amp;lt;/math&amp;gt; is that it is a nonlinear function of &amp;lt;math&amp;gt;\overline{Y}&amp;lt;/math&amp;gt; who is easier to analyze. Nevertheless, we observe that &amp;lt;math&amp;gt;\widehat{Z}&amp;lt;/math&amp;gt; is an &amp;lt;math&amp;gt;(\epsilon,\delta)&amp;lt;/math&amp;gt;-estimator of &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; as long as  &amp;lt;math&amp;gt;\overline{Y}&amp;lt;/math&amp;gt; is an &amp;lt;math&amp;gt;(\epsilon/2,\delta)&amp;lt;/math&amp;gt;-estimator of &amp;lt;math&amp;gt;\frac{1}{z+1}&amp;lt;/math&amp;gt;. This can be deduced by just verifying the following:&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{1-\epsilon/2}{z+1}\le \overline{Y}\le \frac{1+\epsilon/2}{z+1} \implies (1-\epsilon)z\le\frac{1}{\overline{Y}}-1\le (1+\epsilon)z&amp;lt;/math&amp;gt;,&lt;br /&gt;
for &amp;lt;math&amp;gt;\epsilon&amp;lt;\frac{1}{2}&amp;lt;/math&amp;gt;. Therefore,&lt;br /&gt;
:&amp;lt;math&amp;gt;\Pr\left[\,(1-\epsilon)z\le \widehat{Z} \le (1+\epsilon)z\,\right]\ge \Pr\left[\,\frac{1-\epsilon/2}{z+1}\le \overline{Y}\le \frac{1+\epsilon/2}{z+1}\,\right]&lt;br /&gt;
=\Pr\left[\,\left|\overline{Y}-\frac{1}{z+1}\right|\le \frac{\epsilon/2}{z+1}\,\right]&amp;lt;/math&amp;gt;.&lt;br /&gt;
It is then sufficient to show that &amp;lt;math&amp;gt;\Pr\left[\,\left|\overline{Y}-\frac{1}{z+1}\right|\le \frac{\epsilon/2}{z+1}\,\right]\ge 1-\delta&amp;lt;/math&amp;gt; for proving the main theorem above. We will see that this is equivalent to show the concentration inequality &lt;br /&gt;
:&amp;lt;math&amp;gt;\Pr\left[\,\left|\overline{Y}-\mathbb{E}\left[\overline{Y}\right]\right|\le \frac{\epsilon/2}{z+1}\,\right]\ge 1-\delta\quad\qquad({\color{red}*})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{{Theorem|Lemma|&lt;br /&gt;
:The followings hold for each &amp;lt;math&amp;gt;Y_j&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;j=1,2\ldots,k&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;\overline{Y}=\frac{1}{k}\sum_{j=1}^kY_j&amp;lt;/math&amp;gt;:&lt;br /&gt;
:*&amp;lt;math&amp;gt;\mathbb{E}\left[\overline{Y}\right]=\mathbb{E}\left[Y_j\right]=\frac{1}{z+1}&amp;lt;/math&amp;gt;;&lt;br /&gt;
:*&amp;lt;math&amp;gt;\mathbf{Var}\left[Y_j\right]\le\frac{1}{(z+1)^2}&amp;lt;/math&amp;gt;, and consequently &amp;lt;math&amp;gt;\mathbf{Var}\left[\overline{Y}\right]\le\frac{1}{k(z+1)^2}&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
{{Proof|&lt;br /&gt;
As in the case of single hash function, by symmetry it holds that &amp;lt;math&amp;gt;\mathbb{E}[Y_j]=\frac{1}{z+1}&amp;lt;/math&amp;gt; for every &amp;lt;math&amp;gt;j=1,2,\ldots,k&amp;lt;/math&amp;gt;. Therefore,&lt;br /&gt;
:&amp;lt;math&amp;gt;\mathbb{E}\left[\overline{Y}\right]=\frac{1}{k}\sum_{j=1}^k\mathbb{E}[Y_j]=\frac{1}{z+1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
Recall that each &amp;lt;math&amp;gt;Y_j&amp;lt;/math&amp;gt; is the minimum of &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; random hash values uniformly and independently distributed over &amp;lt;math&amp;gt;[0,1]&amp;lt;/math&amp;gt;. By geometry probability, it holds that for any &amp;lt;math&amp;gt;y\in[0,1]&amp;lt;/math&amp;gt;,&lt;br /&gt;
:&amp;lt;math&amp;gt;\Pr[Y_j&amp;gt;y]=(1-y)^z&amp;lt;/math&amp;gt;,&lt;br /&gt;
which means &amp;lt;math&amp;gt;\Pr[Y_j\le y]=1-(1-y)^z&amp;lt;/math&amp;gt;. Taking the derivative with respect to &amp;lt;math&amp;gt;y&amp;lt;/math&amp;gt;, we obtain the probability density function of random variable &amp;lt;math&amp;gt;Y_j&amp;lt;/math&amp;gt;, which is &amp;lt;math&amp;gt;z(1-y)^{z-1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We then compute the second moment.&lt;br /&gt;
:&amp;lt;math&amp;gt;\mathbb{E}[Y_j^2]=\int^{1}_0y^2z(1-y)^{z-1}\,\mathrm{d}y=\frac{2}{(z+1)(z+2)}&amp;lt;/math&amp;gt;.&lt;br /&gt;
The variance is bounded as&lt;br /&gt;
:&amp;lt;math&amp;gt;\mathbf{Var}\left[Y_j\right]=\mathbb{E}\left[Y_j^2\right]-\mathbb{E}\left[Y_j\right]^2=\frac{2}{(z+1)(z+2)}-\frac{1}{(z+1)^2}\le\frac{1}{(z+1)^2}&amp;lt;/math&amp;gt;.&lt;br /&gt;
Due to the (pairwise) independence between &amp;lt;math&amp;gt;Y_j&amp;lt;/math&amp;gt;&#039;s,&lt;br /&gt;
::&amp;lt;math&amp;gt;\mathbf{Var}\left[\overline{Y}\right]=\mathbf{Var}\left[\frac{1}{k}\sum_{j=1}^kY_j\right]=\frac{1}{k^2}\sum_{j=1}^k\mathbf{Var}\left[Y_j\right]\le \frac{1}{k(z+1)^2}&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
We resume to prove the inequality &amp;lt;math&amp;gt;({\color{red}*})&amp;lt;/math&amp;gt;. By [[高级算法_(Fall 2023)/Basic_deviation_inequalities#Chebyshev.27s_inequality|Chebyshev&#039;s inequality]], it holds that &lt;br /&gt;
:&amp;lt;math&amp;gt;\Pr\left[\,\left|\overline{Y}-\mathbb{E}\left[\overline{Y}\right]\right|&amp;gt; \frac{\epsilon/2}{z+1}\,\right]&lt;br /&gt;
\le\frac{4}{\epsilon^2}(z+1)^2\mathbf{Var}\left[\overline{Y}\right]&lt;br /&gt;
\le\frac{4}{\epsilon^2k}&amp;lt;/math&amp;gt;.&lt;br /&gt;
When &amp;lt;math&amp;gt;k\ge\left\lceil\frac{4}{\epsilon^2\delta}\right\rceil&amp;lt;/math&amp;gt;, this probability is at most &amp;lt;math&amp;gt;\delta&amp;lt;/math&amp;gt;. The inequality &amp;lt;math&amp;gt;({\color{red}*})&amp;lt;/math&amp;gt; is proved. As we discussed above, this proves the above main theorem &amp;lt;math&amp;gt;\min&amp;lt;/math&amp;gt;-sketch algorithm improved by the mean trick.&lt;br /&gt;
&lt;br /&gt;
= Frequency Estimation=&lt;br /&gt;
Suppose that &amp;lt;math&amp;gt;U&amp;lt;/math&amp;gt; is the data universe. The &#039;&#039;&#039;frequency estimation&#039;&#039;&#039; problem is defined as follows.&lt;br /&gt;
*&#039;&#039;&#039;Data:&#039;&#039;&#039; a sequence of (not necessarily distinct) elements &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_n\in U&amp;lt;/math&amp;gt;;&lt;br /&gt;
*&#039;&#039;&#039;Query:&#039;&#039;&#039; an element &amp;lt;math&amp;gt;x\in U&amp;lt;/math&amp;gt;;&lt;br /&gt;
*&#039;&#039;&#039;Output:&#039;&#039;&#039; an estimation &amp;lt;math&amp;gt;\hat{f}_x&amp;lt;/math&amp;gt; of the frequency &amp;lt;math&amp;gt;f_x\triangleq|\{i\mid x_i=x\}|&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; in input data.&lt;br /&gt;
&lt;br /&gt;
We still want to give an algorithm in the data stream model: the algorithm scan the input sequence &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_n&amp;lt;/math&amp;gt; to construct a succinct data structure, such that upon each query of &amp;lt;math&amp;gt;x\in U&amp;lt;/math&amp;gt;, the algorithm returns an estimation of the frequency &amp;lt;math&amp;gt;f_x&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Clearly this problem can always be solved by storing all appeared distinct elements along with their frequencies. However, the space cost of this straightforward solution is rather high. Instead, we want to use a lossy representation (a &#039;&#039;sketch&#039;&#039;) of input data which uses significantly less space but can still answer queries with tolarable accuracy. &lt;br /&gt;
&lt;br /&gt;
Formally, upon each query of &amp;lt;math&amp;gt;x\in U&amp;lt;/math&amp;gt;, the algorithm should return an answer &amp;lt;math&amp;gt;\hat{f}_x&amp;lt;/math&amp;gt; satisfying:&lt;br /&gt;
:&amp;lt;math&amp;gt;\Pr\left[\,\left|\hat{f}_x-f_x\right|\le \epsilon n\,\right]\ge 1-\delta&amp;lt;/math&amp;gt;.&lt;br /&gt;
Note that this notion of approximation is with bounded &#039;&#039;additive&#039;&#039; error which is weaker than the notion of &amp;lt;math&amp;gt;(\epsilon,\delta)&amp;lt;/math&amp;gt;-estimator, whose error bound is &#039;&#039;multiplicative&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
With such weak accuracy guarantee, its is possible to give a succinct data structure whose size is determined only by the error bounds &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\delta&amp;lt;/math&amp;gt; but independent of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;, because only the frequencies of those &#039;&#039;&#039;heavy hitters&#039;&#039;&#039; (elements &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; with high frequencies &amp;lt;math&amp;gt;f_x&amp;gt;\epsilon n&amp;lt;/math&amp;gt;) need to be memorized, and there are at most &amp;lt;math&amp;gt;1/\epsilon&amp;lt;/math&amp;gt; many such heavy hitters.&lt;br /&gt;
&lt;br /&gt;
== Count-min sketch==&lt;br /&gt;
The [https://en.wikipedia.org/wiki/Count–min_sketch count-min sketch] given by Cormode and Muthukrishnan is an elegant data structure for frequency estimation.&lt;br /&gt;
&lt;br /&gt;
The data structure is a two-dimensional &amp;lt;math&amp;gt;k\times m&amp;lt;/math&amp;gt; integer array, where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; are two parameters to be determined by the error bounds &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\delta&amp;lt;/math&amp;gt;. We still adopt the Uniform Hash Assumption to assume that we have access to &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; mutually independent uniform random hash functions &amp;lt;math&amp;gt;h_1,h_2,\ldots,h_k: U\to[m]&amp;lt;/math&amp;gt;.&lt;br /&gt;
{{Theorem|&#039;&#039;Count-min sketch&#039;&#039; (Cormode and Muthukrishnan 2003)|&lt;br /&gt;
:Suppose &amp;lt;math&amp;gt;h_1,h_2,\ldots,h_k: U\to[m]&amp;lt;/math&amp;gt; are uniform and independent random hash functions.&lt;br /&gt;
-----&lt;br /&gt;
:&#039;&#039;&#039;Data structure construction:&#039;&#039;&#039; Given a sequence &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_n\in U&amp;lt;/math&amp;gt;, the data structure is a two-dimensional &amp;lt;math&amp;gt;k\times m&amp;lt;/math&amp;gt; integer array &amp;lt;math&amp;gt;CMS[k][m]&amp;lt;/math&amp;gt; constructed as&lt;br /&gt;
:*initialize all entries of &amp;lt;math&amp;gt;CMS[k][m]&amp;lt;/math&amp;gt; to 0;&lt;br /&gt;
:*for &amp;lt;math&amp;gt;i=1,2,\ldots,n&amp;lt;/math&amp;gt;, upon receiving &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt;:&lt;br /&gt;
::: for every &amp;lt;math&amp;gt;1\le j\le k&amp;lt;/math&amp;gt;, evaluate &amp;lt;math&amp;gt;h_j(x_i)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;CMS[j][h_j(x_i)]++&amp;lt;/math&amp;gt;.&lt;br /&gt;
----&lt;br /&gt;
:&#039;&#039;&#039;Query resolution:&#039;&#039;&#039; Upon each query of an arbitrary &amp;lt;math&amp;gt;x\in U&amp;lt;/math&amp;gt;,&lt;br /&gt;
:* return &amp;lt;math&amp;gt;\hat{f}_x=\min_{1\le j\le k}CMS[j][h_j(x)]&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
It is easy to see that the space cost of count-min sketch is &amp;lt;math&amp;gt;O(km)&amp;lt;/math&amp;gt; memory words, or &amp;lt;math&amp;gt;O(km\log n)&amp;lt;/math&amp;gt; bits. Each query is answered within time cost &amp;lt;math&amp;gt;O(k)&amp;lt;/math&amp;gt;, assuming that an evaluation of hash function can be done in unit or constant time. We then analyze the error bounds.&lt;br /&gt;
&lt;br /&gt;
First, it is easy to observe that for any query &amp;lt;math&amp;gt;x\in U&amp;lt;/math&amp;gt; and every hash function &amp;lt;math&amp;gt;1\le j\le k&amp;lt;/math&amp;gt;, it always holds for the corresponding entry in the count-min sketch&lt;br /&gt;
:&amp;lt;math&amp;gt;CMS[j][h_j(x)]\ge f_x&amp;lt;/math&amp;gt;,&lt;br /&gt;
because the appearances of element &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; in the input sequence contribute at least &amp;lt;math&amp;gt;f_x&amp;lt;/math&amp;gt; to the value of &amp;lt;math&amp;gt;CMS[j][h_j(x)]&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Therefore, for any query &amp;lt;math&amp;gt;x\in U&amp;lt;/math&amp;gt; it always holds for the answer &amp;lt;math&amp;gt;\hat{f}_x=\min_{1\le j\le k}CMS[j][h_j(x)]\ge f_x&amp;lt;/math&amp;gt;, which means&lt;br /&gt;
:&amp;lt;math&amp;gt;\Pr\left[\,\left|\hat{f}_x- f_x\right|\ge\epsilon n\,\right]=\Pr\left[\,\hat{f}_x- f_x\ge\epsilon n\,\right]=\prod_{j=1}^k\Pr[\,CMS[j][h_j(x)]-f_x\ge\epsilon n\,],\quad\qquad({\color{red}\diamondsuit})&amp;lt;/math&amp;gt;&lt;br /&gt;
where the second equation is due to the mutual independence of random hash functions &amp;lt;math&amp;gt;h_1,h_2,\ldots,h_k&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
It remains to upper bound the probability &amp;lt;math&amp;gt;\Pr[\,CMS[j][h_j(x)]-f_x\ge\epsilon n\,]&amp;lt;/math&amp;gt;, which can be done by calculating the expectation of &amp;lt;math&amp;gt;CMS[j][h_j(x)]&amp;lt;/math&amp;gt;.&lt;br /&gt;
{{Theorem|Proposition|&lt;br /&gt;
:For any &amp;lt;math&amp;gt;x\in U&amp;lt;/math&amp;gt; and every &amp;lt;math&amp;gt;1\le j\le k&amp;lt;/math&amp;gt;, it holds that &amp;lt;math&amp;gt;\mathbb{E}\left[CMS[j][h_j(x)]\right]\le f_x+\frac{n}{m}&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
{{Proof|&lt;br /&gt;
The value of &amp;lt;math&amp;gt;CMS[j][h_j(x)]&amp;lt;/math&amp;gt; is constituted by the frequency &amp;lt;math&amp;gt;f_x&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and the frequencies &amp;lt;math&amp;gt;f_y&amp;lt;/math&amp;gt; of all other elements &amp;lt;math&amp;gt;y\neq x&amp;lt;/math&amp;gt; among &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_n&amp;lt;/math&amp;gt;, thus&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{align}&lt;br /&gt;
CMS[j][h_j(x)]&lt;br /&gt;
&amp;amp;=f_x+\sum_{\scriptstyle y\in\{x_1,\ldots,x_n\}\setminus\{x\}\atop\scriptstyle h_j(y)=h_j(x)} f_y\\&lt;br /&gt;
&amp;amp;=f_x+\sum_{y\in\{x_1,\ldots,x_n\}\setminus\{x\}} f_y \cdot I[h_j(y)=h_j(x)]&lt;br /&gt;
\end{align}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math&amp;gt;I[h_j(y)=h_j(x)]&amp;lt;/math&amp;gt; denotes the Boolean random variable that indicates the occurrence of event &amp;lt;math&amp;gt;h_j(y)=h_j(x)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
By linearity of expectation,&lt;br /&gt;
:&amp;lt;math&amp;gt;\mathbb{E}[CMS[j][h_j(x)]]=f_x+\sum_{y\in\{x_1,x_2,\ldots,x_n\}\setminus\{x\}} f_y \cdot \Pr[h_j(y)=h_j(x)]&amp;lt;/math&amp;gt;.&lt;br /&gt;
Due to Uniform Hash Assumption (UHA), &amp;lt;math&amp;gt;h_j: U\to[m]&amp;lt;/math&amp;gt; is a uniform random function. For any &amp;lt;math&amp;gt;y\neq x&amp;lt;/math&amp;gt;, the probability of hash collision is&lt;br /&gt;
:&amp;lt;math&amp;gt;\Pr[h_j(y)=h_j(x)]=\frac{1}{m}&amp;lt;/math&amp;gt;.&lt;br /&gt;
Therefore,&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{align}&lt;br /&gt;
\mathbb{E}[CMS[j][h_j(x)]]&lt;br /&gt;
&amp;amp;=f_x+\frac{1}{m}\sum_{y\in\{x_1,\ldots,x_n\}\setminus\{x\}} f_y \\&lt;br /&gt;
&amp;amp;\le f_x+\frac{1}{m}\sum_{y\in\{x_1,\ldots,x_n\}} f_y\\&lt;br /&gt;
&amp;amp;=f_x+\frac{n}{m},&lt;br /&gt;
\end{align}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where the last equation is due to the obvious identity &amp;lt;math&amp;gt;\sum_{y\in\{x_1,\ldots,x_n\}}f_y=n&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
The above proposition shows that for any &amp;lt;math&amp;gt;x\in U&amp;lt;/math&amp;gt; and every &amp;lt;math&amp;gt;1\le j\le k&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\mathbb{E}\left[CMS[j][h_j(x)]-f_x\right]\le \frac{n}{m}&amp;lt;/math&amp;gt;.&lt;br /&gt;
Recall that &amp;lt;math&amp;gt;CMS[j][h_j(x)]\ge f_x&amp;lt;/math&amp;gt; always holds, thus &amp;lt;math&amp;gt;CMS[j][h_j(x)]-f_x&amp;lt;/math&amp;gt; is a positive random variable. By Markov&#039;s inequality, we have&lt;br /&gt;
:&amp;lt;math&amp;gt;\Pr[\,CMS[j][h_j(x)]-f_x\ge\epsilon n\,]\le \frac{1}{\epsilon m}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Combining with above equation &amp;lt;math&amp;gt;({\color{red}\diamondsuit})&amp;lt;/math&amp;gt;, we have&lt;br /&gt;
:&amp;lt;math&amp;gt;\Pr\left[\,\left|\hat{f}_x- f_x\right|\ge\epsilon n\,\right]=(\Pr[\,CMS[j][h_j(x)]-f_x\ge\epsilon n\,])^k\le \frac{1}{(\epsilon m)^k}&amp;lt;/math&amp;gt;.&lt;br /&gt;
By setting &amp;lt;math&amp;gt;m=\left\lceil\frac{\mathrm{e}}{\epsilon}\right\rceil&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;k=\left\lceil\ln\frac{1}{\delta}\right\rceil&amp;lt;/math&amp;gt;, the above error probability is bounded as &amp;lt;math&amp;gt;\frac{1}{(\epsilon m)^k}\le\delta&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
For any positive &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\delta&amp;lt;/math&amp;gt;, the count-min sketch gives a data structure of size &amp;lt;math&amp;gt;O(km)=O\left(\frac{1}{\epsilon}\log\frac{1}{\delta}\right)&amp;lt;/math&amp;gt; (in memory words) and answering each query &amp;lt;math&amp;gt;x\in U&amp;lt;/math&amp;gt; in time &amp;lt;math&amp;gt;O(k)=O\left(\frac{1}{\epsilon}\right)&amp;lt;/math&amp;gt; with the following accuracy guarantee:&lt;br /&gt;
:&amp;lt;math&amp;gt;\Pr\left[\,\left|\hat{f}_x- f_x\right|\le\epsilon n\,\right]\ge 1-\delta&amp;lt;/math&amp;gt;.&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=%E9%AB%98%E7%BA%A7%E7%AE%97%E6%B3%95_(Fall_2024)/Hashing_and_Sketching&amp;diff=12636</id>
		<title>高级算法 (Fall 2024)/Hashing and Sketching</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=%E9%AB%98%E7%BA%A7%E7%AE%97%E6%B3%95_(Fall_2024)/Hashing_and_Sketching&amp;diff=12636"/>
		<updated>2024-10-02T12:19:57Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: /* Families of universal hash functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Balls into Bins=&lt;br /&gt;
The following is the so-called balls into bins model.&lt;br /&gt;
Consider throwing &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; balls into &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; bins uniformly and independently at random. This is equivalent to a random mapping &amp;lt;math&amp;gt;f:[m]\to[n]&amp;lt;/math&amp;gt;. Needless to say, random mapping is an important random model and may have many applications in Computer Science, e.g. hashing.&lt;br /&gt;
&lt;br /&gt;
We are concerned with the following three questions regarding the balls into bins model:&lt;br /&gt;
* birthday problem: the probability that every bin contains at most one ball (the mapping is 1-1);&lt;br /&gt;
* coupon collector problem: the probability that every bin contains at least one ball (the mapping is on-to);&lt;br /&gt;
* occupancy problem: the maximum load of bins.&lt;br /&gt;
&lt;br /&gt;
== Birthday Problem==&lt;br /&gt;
We now consider the &#039;&#039;&#039;birthday problem&#039;&#039;&#039;.&lt;br /&gt;
There are &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; students in the class. Assume that for each student, his/her birthday is uniformly and independently distributed over the 365 days in a years. We wonder what the probability that no two students share a birthday.&lt;br /&gt;
&lt;br /&gt;
Due to the [http://en.wikipedia.org/wiki/Pigeonhole_principle pigeonhole principle], it is obvious that for &amp;lt;math&amp;gt;m&amp;gt;365&amp;lt;/math&amp;gt;, there must be two students with the same birthday. Surprisingly, for any &amp;lt;math&amp;gt;m&amp;gt;57&amp;lt;/math&amp;gt; this event occurs with more than 99% probability. This is called the [http://en.wikipedia.org/wiki/Birthday_problem &#039;&#039;&#039;birthday paradox&#039;&#039;&#039;]. Despite the name, the birthday paradox is not a real paradox.&lt;br /&gt;
&lt;br /&gt;
We can model this problem as a balls-into-bins problem. &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; different balls (students) are uniformly and independently thrown into 365 bins (days). More generally, let &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; be the number of bins. We ask for the probability of the following event &amp;lt;math&amp;gt;\mathcal{E}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathcal{E}&amp;lt;/math&amp;gt;: there is no bin with more than one balls (i.e. no two students share birthday).&lt;br /&gt;
&lt;br /&gt;
We first analyze this by counting. There are totally &amp;lt;math&amp;gt;n^m&amp;lt;/math&amp;gt; ways of assigning &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; balls to &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; bins. The number of assignments that no two balls share a bin is &amp;lt;math&amp;gt;{n\choose m}m!&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Thus the probability is given by:&lt;br /&gt;
:&amp;lt;math&amp;gt;\begin{align}&lt;br /&gt;
\Pr[\mathcal{E}]&lt;br /&gt;
=&lt;br /&gt;
\frac{{n\choose m}m!}{n^m}.&lt;br /&gt;
\end{align}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Recall that &amp;lt;math&amp;gt;{n\choose m}=\frac{n!}{(n-m)!m!}&amp;lt;/math&amp;gt;. Then &lt;br /&gt;
:&amp;lt;math&amp;gt;\begin{align}&lt;br /&gt;
\Pr[\mathcal{E}]&lt;br /&gt;
=&lt;br /&gt;
\frac{{n\choose m}m!}{n^m}&lt;br /&gt;
=&lt;br /&gt;
\frac{n!}{n^m(n-m)!}&lt;br /&gt;
=&lt;br /&gt;
\frac{n}{n}\cdot\frac{n-1}{n}\cdot\frac{n-2}{n}\cdots\frac{n-(m-1)}{n}&lt;br /&gt;
=&lt;br /&gt;
\prod_{k=1}^{m-1}\left(1-\frac{k}{n}\right).&lt;br /&gt;
\end{align}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is also a more &amp;quot;probabilistic&amp;quot; argument for the above equation. Consider again that &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; students are mapped to &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; possible birthdays uniformly at random.&lt;br /&gt;
&lt;br /&gt;
The first student has a birthday for sure. The probability that the second student has a different birthday from the first student is &amp;lt;math&amp;gt;\left(1-\frac{1}{n}\right)&amp;lt;/math&amp;gt;. Given that the first two students have different birthdays, the probability that the third student has a different birthday from the first two students is &amp;lt;math&amp;gt;\left(1-\frac{2}{n}\right)&amp;lt;/math&amp;gt;. Continuing this on, assuming that the first &amp;lt;math&amp;gt;k-1&amp;lt;/math&amp;gt; students all have different birthdays, the probability that the &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt;th student has a different birthday than the first &amp;lt;math&amp;gt;k-1&amp;lt;/math&amp;gt;, is given by &amp;lt;math&amp;gt;\left(1-\frac{k-1}{n}\right)&amp;lt;/math&amp;gt;. By the chain rule, the probability that all &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; students have different birthdays is:&lt;br /&gt;
:&amp;lt;math&amp;gt;\begin{align}&lt;br /&gt;
\Pr[\mathcal{E}]=\left(1-\frac{1}{n}\right)\cdot \left(1-\frac{2}{n}\right)\cdots \left(1-\frac{m-1}{n}\right)&lt;br /&gt;
&amp;amp;=&lt;br /&gt;
\prod_{k=1}^{m-1}\left(1-\frac{k}{n}\right),&lt;br /&gt;
\end{align}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
which is the same as what we got by the counting argument.&lt;br /&gt;
&lt;br /&gt;
[[File:Birthday.png|border|450px|right]]&lt;br /&gt;
&lt;br /&gt;
There are several ways of analyzing this formular. Here is a convenient one: Due to [http://en.wikipedia.org/wiki/Taylor_series Taylor&#039;s expansion], &amp;lt;math&amp;gt;e^{-k/n}\approx 1-k/n&amp;lt;/math&amp;gt;. Then&lt;br /&gt;
:&amp;lt;math&amp;gt;\begin{align}&lt;br /&gt;
\prod_{k=1}^{m-1}\left(1-\frac{k}{n}\right)&lt;br /&gt;
&amp;amp;\approx&lt;br /&gt;
\prod_{k=1}^{m-1}e^{-\frac{k}{n}}\\&lt;br /&gt;
&amp;amp;=&lt;br /&gt;
\exp\left(-\sum_{k=1}^{m-1}\frac{k}{n}\right)\\&lt;br /&gt;
&amp;amp;=&lt;br /&gt;
e^{-m(m-1)/2n}\\&lt;br /&gt;
&amp;amp;\approx&lt;br /&gt;
e^{-m^2/2n}.&lt;br /&gt;
\end{align}&amp;lt;/math&amp;gt;&lt;br /&gt;
The quality of this approximation is shown in the Figure.&lt;br /&gt;
&lt;br /&gt;
Therefore, for &amp;lt;math&amp;gt;m=\sqrt{2n\ln \frac{1}{\epsilon}}&amp;lt;/math&amp;gt;, the probability that &amp;lt;math&amp;gt;\Pr[\mathcal{E}]\approx\epsilon&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Universal Hashing ==&lt;br /&gt;
Hashing is one of the oldest tools in Computer Science. Knuth&#039;s memorandum in 1963 on analysis of hash tables is now considered to be the birth of the area of analysis of algorithms.&lt;br /&gt;
* Knuth. Notes on &amp;quot;open&amp;quot; addressing, July 22 1963. Unpublished memorandum.&lt;br /&gt;
&lt;br /&gt;
The idea of hashing is simple: an unknown set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; data &#039;&#039;&#039;items&#039;&#039;&#039; (or keys) are drawn from a large &#039;&#039;&#039;universe&#039;&#039;&#039; &amp;lt;math&amp;gt;U=[N]&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;N\gg n&amp;lt;/math&amp;gt;; in order to store &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; in a table of &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; entries (slots), we assume a consistent mapping (called a &#039;&#039;&#039;hash function&#039;&#039;&#039;) from the universe &amp;lt;math&amp;gt;U&amp;lt;/math&amp;gt; to a small range &amp;lt;math&amp;gt;[M]&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
This idea seems clever: we use a consistent mapping to deal with an arbitrary unknown data set. However, there is a fundamental flaw for hashing.&lt;br /&gt;
* For sufficiently large universe (&amp;lt;math&amp;gt;N&amp;gt; M(n-1)&amp;lt;/math&amp;gt;), for any function, there exists a bad data set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;, such that all items in &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; are mapped to the same entry in the table.&lt;br /&gt;
&lt;br /&gt;
A simple use of pigeonhole principle can prove the above statement. &lt;br /&gt;
&lt;br /&gt;
To overcome this situation, randomization is introduced into hashing. We assume that the hash function is a random mapping from &amp;lt;math&amp;gt;[N]&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;[M]&amp;lt;/math&amp;gt;. In order to ease the analysis, the following ideal assumption is used:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Simple Uniform Hash Assumption&#039;&#039;&#039; (&#039;&#039;&#039;SUHA&#039;&#039;&#039; or &#039;&#039;&#039;UHA&#039;&#039;&#039;, a.k.a. the random oracle model): &lt;br /&gt;
:A &#039;&#039;uniform&#039;&#039; random function &amp;lt;math&amp;gt;h:[N]\rightarrow[M]&amp;lt;/math&amp;gt; is available and the computation of &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; is efficient.&lt;br /&gt;
&lt;br /&gt;
=== Families of universal hash functions ===&lt;br /&gt;
The assumption of completely random function simplifies the analysis.  However, in practice, truly uniform random hash function is extremely expensive to compute and store. Thus, this simple assumption can hardly represent the reality.&lt;br /&gt;
&lt;br /&gt;
There are two approaches for implementing practical hash functions. One is to use &#039;&#039;ad hoc&#039;&#039; implementations and wish they may work. The other approach is to construct class of hash functions which are efficient to compute and store but with weaker randomness guarantees, and then analyze the applications of hash functions based on this weaker assumption of randomness.&lt;br /&gt;
&lt;br /&gt;
This route was took by Carter and Wegman in 1977 while they introduced universal families of hash functions.&lt;br /&gt;
&lt;br /&gt;
{{Theorem&lt;br /&gt;
|Definition (universal hash families)|&lt;br /&gt;
:Let &amp;lt;math&amp;gt;[N]&amp;lt;/math&amp;gt; be a universe with &amp;lt;math&amp;gt;N\ge M&amp;lt;/math&amp;gt;. A family of hash functions &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;[N]&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;[M]&amp;lt;/math&amp;gt; is said to be &#039;&#039;&#039;&amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt;-universal&#039;&#039;&#039; if, for any distinct items &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_k\in [N]&amp;lt;/math&amp;gt; and for a hash function &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; chosen uniformly at random from &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt;, we have &lt;br /&gt;
::&amp;lt;math&amp;gt;&lt;br /&gt;
\Pr[h(x_1)=h(x_2)=\cdots=h(x_k)]\le\frac{1}{M^{k-1}}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:A family of hash functions &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;[N]&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;[M]&amp;lt;/math&amp;gt; is said to be &#039;&#039;&#039;strongly &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt;-universal&#039;&#039;&#039; if, for any distinct items &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_k\in [N]&amp;lt;/math&amp;gt;, any values &amp;lt;math&amp;gt;y_1,y_2,\ldots,y_k\in[M]&amp;lt;/math&amp;gt;, and for a hash function &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; chosen uniformly at random from &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt;, we have &lt;br /&gt;
::&amp;lt;math&amp;gt;&lt;br /&gt;
\Pr[h(x_1)=y_1\wedge h(x_2)=y_2 \wedge \cdots \wedge h(x_k)=y_k]=\frac{1}{M^{k}}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
In particular, for a 2-universal family &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt;, for any distinct elements &amp;lt;math&amp;gt;x_1,x_2\in[N]&amp;lt;/math&amp;gt;, a uniform random &amp;lt;math&amp;gt;h\in\mathcal{H}&amp;lt;/math&amp;gt; has&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\Pr[h(x_1)=h(x_2)]\le\frac{1}{M}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
For a strongly 2-universal family &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt;, for any distinct elements &amp;lt;math&amp;gt;x_1,x_2\in[N]&amp;lt;/math&amp;gt; and any values &amp;lt;math&amp;gt;y_1,y_2\in[M]&amp;lt;/math&amp;gt;, a uniform random &amp;lt;math&amp;gt;h\in\mathcal{H}&amp;lt;/math&amp;gt; has&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\Pr[h(x_1)=y_1\wedge h(x_2)=y_2]=\frac{1}{M^2}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
This behavior is exactly the same as uniform random hash functions on any distinct pair of inputs. For this reason, a strongly 2-universal hash family are also called pairwise independent hash functions.&lt;br /&gt;
&lt;br /&gt;
=== 2-universal hash families ===&lt;br /&gt;
&lt;br /&gt;
The construction of pairwise independent random variables via modulo a prime introduced in Section 1 already provides a way of constructing a strongly 2-universal hash family.&lt;br /&gt;
&lt;br /&gt;
Let &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; be a prime. The function &amp;lt;math&amp;gt;h_{a,b}:[p]\rightarrow [p]&amp;lt;/math&amp;gt; is defined by&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
h_{a,b}(x)=(ax+b)\bmod p,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
and the family is&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{H}=\{h_{a,b}\mid a,b\in[p]\}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Theorem&lt;br /&gt;
|Lemma|&lt;br /&gt;
:&amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt; is strongly 2-universal.&lt;br /&gt;
}}&lt;br /&gt;
{{Proof| In Section 1, we have proved the pairwise independence of the sequence of &amp;lt;math&amp;gt;(a i+b)\bmod p&amp;lt;/math&amp;gt;, for &amp;lt;math&amp;gt;i=0,1,\ldots, p-1&amp;lt;/math&amp;gt;, which directly implies that &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt; is strongly 2-universal.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
;The original construction of Carter-Wegman&lt;br /&gt;
What if we want to have hash functions from &amp;lt;math&amp;gt;[N]&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;[M]&amp;lt;/math&amp;gt; for non-prime &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;? Carter and Wegman developed the following method.&lt;br /&gt;
&lt;br /&gt;
Suppose that the universe is &amp;lt;math&amp;gt;[N]&amp;lt;/math&amp;gt;, and the functions map &amp;lt;math&amp;gt;[N]&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;[M]&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;N\ge M&amp;lt;/math&amp;gt;. For some prime &amp;lt;math&amp;gt;p\ge N&amp;lt;/math&amp;gt;, let&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
h_{a,b}(x)=((ax+b)\bmod p)\bmod M,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
and the family&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{H}=\{h_{a,b}\mid 1\le a\le p-1, b\in[p]\}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
Note that unlike the first construction, now &amp;lt;math&amp;gt;a\neq 0&amp;lt;/math&amp;gt;.&lt;br /&gt;
{{Theorem&lt;br /&gt;
|Lemma (Carter-Wegman)|&lt;br /&gt;
:&amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt; is 2-universal.&lt;br /&gt;
}}&lt;br /&gt;
{{Proof| Due to the definition of &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt;, there are &amp;lt;math&amp;gt;p(p-1)&amp;lt;/math&amp;gt; many different hash functions in &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt;, because each hash function in &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt; corresponds to a pair of &amp;lt;math&amp;gt;1\le a\le p-1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;b\in[p]&amp;lt;/math&amp;gt;. We only need to count for any particular pair of &amp;lt;math&amp;gt;x_1,x_2\in[N]&amp;lt;/math&amp;gt; that &amp;lt;math&amp;gt;x_1\neq x_2&amp;lt;/math&amp;gt;, the number of hash functions that &amp;lt;math&amp;gt;h(x_1)=h(x_2)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We first note that for any &amp;lt;math&amp;gt;x_1\neq x_2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a x_1+b\not\equiv a x_2+b \pmod p&amp;lt;/math&amp;gt;. This is because &amp;lt;math&amp;gt;a x_1+b\equiv a x_2+b \pmod p&amp;lt;/math&amp;gt; would imply that &amp;lt;math&amp;gt;a(x_1-x_2)\equiv 0\pmod p&amp;lt;/math&amp;gt;, which can never happen since &amp;lt;math&amp;gt;1\le a\le p-1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;x_1\neq x_2&amp;lt;/math&amp;gt; (note that &amp;lt;math&amp;gt;x_1,x_2\in[N]&amp;lt;/math&amp;gt; for an &amp;lt;math&amp;gt;N\le p&amp;lt;/math&amp;gt;).  Therefore, we can assume that &amp;lt;math&amp;gt;(a x_1+b)\bmod p=u&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;(a x_2+b)\bmod p=v&amp;lt;/math&amp;gt; for &amp;lt;math&amp;gt;u\neq v&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
By linear algebra (over finite field), for any &amp;lt;math&amp;gt;x_1,x_2\in[N]&amp;lt;/math&amp;gt; that &amp;lt;math&amp;gt;x_1\neq x_2&amp;lt;/math&amp;gt;, for any &amp;lt;math&amp;gt;u,v\in[p]&amp;lt;/math&amp;gt; that &amp;lt;math&amp;gt;u\neq v&amp;lt;/math&amp;gt;, there is exact one solution to &amp;lt;math&amp;gt;(a,b)&amp;lt;/math&amp;gt; satisfying:&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{cases}&lt;br /&gt;
a x_1+b \equiv u \pmod p\\&lt;br /&gt;
a x_2+b \equiv v \pmod p.&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
After modulo &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;, every &amp;lt;math&amp;gt;u\in[p]&amp;lt;/math&amp;gt; has at most &amp;lt;math&amp;gt;\lceil p/M\rceil -1&amp;lt;/math&amp;gt; many &amp;lt;math&amp;gt;v\in[p]&amp;lt;/math&amp;gt; that &amp;lt;math&amp;gt;v\neq u&amp;lt;/math&amp;gt; but &amp;lt;math&amp;gt;v\equiv u\pmod M&amp;lt;/math&amp;gt;. Therefore, for every pair of &amp;lt;math&amp;gt;x_1,x_2\in[N]&amp;lt;/math&amp;gt; that &amp;lt;math&amp;gt;x_1\neq x_2&amp;lt;/math&amp;gt;, there exist at most &amp;lt;math&amp;gt;p(\lceil p/M\rceil -1)\le p(p-1)/M&amp;lt;/math&amp;gt; pairs of &amp;lt;math&amp;gt;1\le a\le p-1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;b\in[p]&amp;lt;/math&amp;gt; such that &amp;lt;math&amp;gt;((ax_1+b)\bmod p)\bmod M=((ax_2+b)\bmod p)\bmod M&amp;lt;/math&amp;gt;, which means there are at most &amp;lt;math&amp;gt; p(p-1)/M&amp;lt;/math&amp;gt; many hash functions &amp;lt;math&amp;gt;h\in\mathcal{H}&amp;lt;/math&amp;gt; having &amp;lt;math&amp;gt;h(x_1)=h(x_2)&amp;lt;/math&amp;gt; for &amp;lt;math&amp;gt;x_1\neq x_2&amp;lt;/math&amp;gt;. For &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; uniformly chosen from &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt;, for any &amp;lt;math&amp;gt;x_1\neq x_2&amp;lt;/math&amp;gt;,&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\Pr[h(x_1)=h(x_2)]\le \frac{p(p-1)/M}{p(p-1)}=\frac{1}{M}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
We prove that &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt; is 2-universal.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
;A construction used in practice&lt;br /&gt;
The main issue of Carter-Wegman construction is the efficiency. The mod operation is very slow, and has been so for more than 30 years.&lt;br /&gt;
&lt;br /&gt;
The following construction is due to Dietzfelbinger &#039;&#039;et al&#039;&#039;. It was published in 1997 and has been practically used in various applications of universal hashing.&lt;br /&gt;
&lt;br /&gt;
The family of hash functions is from &amp;lt;math&amp;gt;[2^u]&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;[2^v]&amp;lt;/math&amp;gt;. With a binary representation, the functions map binary strings of length &amp;lt;math&amp;gt;u&amp;lt;/math&amp;gt; to binary strings of length &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt;.&lt;br /&gt;
Let&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
h_{a}(x)=\left\lfloor\frac{a\cdot x\bmod 2^u}{2^{u-v}}\right\rfloor,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
and the family&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{H}=\{h_{a}\mid a\in[2^v]\mbox{ and }a\mbox{ is odd}\}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This family of hash functions does not exactly meet the requirement of 2-universal family. However,  Dietzfelbinger &#039;&#039;et al&#039;&#039; proved that &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt; is close to a 2-universal family. Specifically, for any input values &amp;lt;math&amp;gt;x_1,x_2\in[2^u]&amp;lt;/math&amp;gt;, for a uniformly random &amp;lt;math&amp;gt;h\in\mathcal{H}&amp;lt;/math&amp;gt;,&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\Pr[h(x_1)=h(x_2)]\le\frac{1}{2^{v-1}}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
So &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt; is within an approximation ratio of 2 to being 2-universal. The proof uses the fact that odd numbers are relative prime to a power of 2.&lt;br /&gt;
&lt;br /&gt;
The function is extremely simple to compute in c language.&lt;br /&gt;
We exploit that C-multiplication (*) of unsigned u-bit numbers is done &amp;lt;math&amp;gt;\bmod 2^u&amp;lt;/math&amp;gt;, and have a one-line C-code for computing the hash function:&lt;br /&gt;
 h_a(x) = (a*x)&amp;gt;&amp;gt;(u-v)&lt;br /&gt;
The bit-wise shifting is a lot faster than modular. It explains the popularity of this scheme in practice than the original Carter-Wegman construction.&lt;br /&gt;
&lt;br /&gt;
== Collision number ==&lt;br /&gt;
Consider a 2-universal family &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt; of hash functions from &amp;lt;math&amp;gt;[N]&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;[M]&amp;lt;/math&amp;gt;. Let &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; be a hash function chosen uniformly from &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt;. For a fixed set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; distinct elements from &amp;lt;math&amp;gt;[N]&amp;lt;/math&amp;gt;, say &amp;lt;math&amp;gt;S=\{x_1,x_2,\ldots,x_n\}&amp;lt;/math&amp;gt;, the elements are mapped to the hash values &amp;lt;math&amp;gt;h(x_1), h(x_2), \ldots, h(x_n)&amp;lt;/math&amp;gt;. This can be seen as throwing &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; balls to &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; bins, with pairwise independent choices of bins.&lt;br /&gt;
&lt;br /&gt;
As in the balls-into-bins with full independence, we are curious about the questions such as the birthday problem or the maximum load. These questions are interesting not only because they are natural to ask in a balls-into-bins setting, but in the context of hashing, they are closely related to the performance of hash functions.&lt;br /&gt;
&lt;br /&gt;
The old techniques for analyzing balls-into-bins rely too much on the independence of the choice of the bin for each ball, therefore can hardly be extended to the setting of 2-universal hash families. However, it turns out several balls-into-bins questions can somehow be answered by analyzing a very natural quantity: the number of &#039;&#039;&#039;collision pairs&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A collision pair for hashing is a pair of elements &amp;lt;math&amp;gt;x_1,x_2\in S&amp;lt;/math&amp;gt; which are mapped to the same hash value, i.e. &amp;lt;math&amp;gt;h(x_1)=h(x_2)&amp;lt;/math&amp;gt;. Formally, for a fixed set of elements &amp;lt;math&amp;gt;S=\{x_1,x_2,\ldots,x_n\}&amp;lt;/math&amp;gt;, for any &amp;lt;math&amp;gt;1\le i,j\le n&amp;lt;/math&amp;gt;, let the random variable&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
X_{ij}&lt;br /&gt;
=&lt;br /&gt;
\begin{cases}&lt;br /&gt;
1 &amp;amp; \text{if }h(x_i)=h(x_j),\\&lt;br /&gt;
0 &amp;amp; \text{otherwise.}&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
The total number of collision pairs among the &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; items &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_n&amp;lt;/math&amp;gt; is &lt;br /&gt;
:&amp;lt;math&amp;gt;X=\sum_{i&amp;lt;j} X_{ij}.\,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt; is 2-universal, for any &amp;lt;math&amp;gt;i\neq j&amp;lt;/math&amp;gt;,&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\Pr[X_{ij}=1]=\Pr[h(x_i)=h(x_j)]\le\frac{1}{M}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The expected number of collision pairs is &lt;br /&gt;
:&amp;lt;math&amp;gt;\mathbf{E}[X]=\mathbf{E}\left[\sum_{i&amp;lt;j}X_{ij}\right]=\sum_{i&amp;lt;j}\mathbf{E}[X_{ij}]=\sum_{i&amp;lt;j}\Pr[X_{ij}=1]\le{n\choose 2}\frac{1}{M}&amp;lt;\frac{n^2}{2M}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In particular, for &amp;lt;math&amp;gt;n=M&amp;lt;/math&amp;gt;, i.e. &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; items are mapped to &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; hash values by a pairwise independent hash function, the expected collision number is &amp;lt;math&amp;gt;\mathbf{E}[X]&amp;lt;\frac{n^2}{2M}=\frac{n}{2}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The above analysis gives us an estimation on the expected number of collision pairs, such that &amp;lt;math&amp;gt;\mathbf{E}[X]&amp;lt;\frac{n^2}{2M}&amp;lt;/math&amp;gt;. Apply the Markov&#039;s inequality, for &amp;lt;math&amp;gt;0&amp;lt;\epsilon&amp;lt;1&amp;lt;/math&amp;gt;, we have&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\Pr\left[X\ge \frac{n^2}{2\epsilon M}\right]\le\Pr\left[X\ge \frac{1}{\epsilon}\mathbf{E}[X]\right]\le\epsilon.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;n\le\sqrt{2\epsilon M}&amp;lt;/math&amp;gt;, the number of collision pairs is &amp;lt;math&amp;gt;X\ge1&amp;lt;/math&amp;gt; with probability at most &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;, therefore with probability at least &amp;lt;math&amp;gt;1-\epsilon&amp;lt;/math&amp;gt;, there is no collision at all. Therefore, we have the following theorem.&lt;br /&gt;
{{Theorem&lt;br /&gt;
|Theorem|&lt;br /&gt;
:If &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; is chosen uniformly from a 2-universal family of hash functions mapping the universe &amp;lt;math&amp;gt;[N]&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;[M]&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;N\ge M&amp;lt;/math&amp;gt;, then for any set &amp;lt;math&amp;gt;S\subset [N]&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; items, where &amp;lt;math&amp;gt;n\le\sqrt{2\epsilon M}&amp;lt;/math&amp;gt;, the probability that there exits a collision pair is&lt;br /&gt;
::&amp;lt;math&amp;gt;&lt;br /&gt;
\Pr[\mbox{collision occurs}]\le\epsilon.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Recall that for mutually independent choices of bins, for some &amp;lt;math&amp;gt;n=\sqrt{2M\ln(1/\epsilon)}&amp;lt;/math&amp;gt;, the probability that a collision occurs is about &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;. For constant &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;, this gives an essentially same bound as the pairwise independent setting. Therefore, &lt;br /&gt;
the behavior of pairwise independent hash function is essentially the same as the uniform random hash function for the birthday problem. This is easy to understand, because birthday problem is about the behavior of collisions, and the definition of 2-universal hash function can be interpreted as &amp;quot;functions that the probability of collision is as low as a uniform random function&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
= Set  Membership=&lt;br /&gt;
A basic question in Computer Science is:&lt;br /&gt;
:&amp;quot;&amp;lt;math&amp;gt;\mbox{Is }x\in S?&amp;lt;/math&amp;gt;&amp;quot;&lt;br /&gt;
for a set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; and an element &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt;. This is the &#039;&#039;&#039;set membership&#039;&#039;&#039; problem.&lt;br /&gt;
&lt;br /&gt;
Formally, given an arbitrary set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; elements from a universe &amp;lt;math&amp;gt;U&amp;lt;/math&amp;gt;, we want to use a succinct &#039;&#039;&#039;data structure&#039;&#039;&#039; to represent this set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;, so that upon each &#039;&#039;&#039;query&#039;&#039;&#039; of any element &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; from the universe &amp;lt;math&amp;gt;[N]&amp;lt;/math&amp;gt;, the question of whether &amp;lt;math&amp;gt;x\in S&amp;lt;/math&amp;gt; is efficiently answered. The complexity of such data structure is measured in two-fold:&lt;br /&gt;
* &#039;&#039;&#039;space cost&#039;&#039;&#039;: size of the data structure to represent a set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; of size &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;;&lt;br /&gt;
* &#039;&#039;&#039;time cost&#039;&#039;&#039;: time complexity of answering each query by accessing to the data structure.&lt;br /&gt;
&lt;br /&gt;
Suppose that the universe &amp;lt;math&amp;gt;U&amp;lt;/math&amp;gt; is of size &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;. Clearly, the membership problem can be solved by a &#039;&#039;&#039;dictionary data structure&#039;&#039;&#039;, e.g.:&lt;br /&gt;
* &#039;&#039;&#039;sorted table / balanced search tree&#039;&#039;&#039;: with space cost &amp;lt;math&amp;gt;O(n\log N)&amp;lt;/math&amp;gt; bits and time cost &amp;lt;math&amp;gt;O(\log n)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Note that &amp;lt;math&amp;gt;\log{N\choose n}=\Theta\left(n\log \frac{N}{n}\right)&amp;lt;/math&amp;gt; is the entropy of sets &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; elements from a universe &amp;lt;math&amp;gt;U&amp;lt;/math&amp;gt; of size &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;. Therefore it is necessary to use so many bits to represent a set without losing any information. &lt;br /&gt;
With hashing, we can solve this fundamental problem with asymptotic optimal space cost and time cost at the same time.&lt;br /&gt;
&lt;br /&gt;
== Perfect hashing using quadratic space==&lt;br /&gt;
The idea of perfect hashing is that we use a hash function &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; to map the &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; items to distinct entries of the table; store every item &amp;lt;math&amp;gt;x\in S&amp;lt;/math&amp;gt; in the entry &amp;lt;math&amp;gt;h(x)&amp;lt;/math&amp;gt;; and also store the hash function &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; in a fixed location in the table (usually the beginning of the table). The algorithm for searching for an item is as follows:&lt;br /&gt;
&lt;br /&gt;
:search for &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; in table &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;:&lt;br /&gt;
# retrieve &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; from a fixed location in the table;&lt;br /&gt;
# if &amp;lt;math&amp;gt;x=T[h(x)]&amp;lt;/math&amp;gt; return &amp;lt;math&amp;gt;h(x)&amp;lt;/math&amp;gt;; else return NOT_FOUND;&lt;br /&gt;
&lt;br /&gt;
This scheme works as long as that the hash function satisfies the following two conditions:&lt;br /&gt;
* The description of &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; is sufficiently short, so that &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; can be stored in one entry (or in constant many entries) of the table.&lt;br /&gt;
* &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; has no collisions on &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;, i.e. there is no pair of items &amp;lt;math&amp;gt;x_1,x_2\in S&amp;lt;/math&amp;gt; that are mapped to the same value by &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The first condition is easy to guarantee for 2-universal hash families. As shown by Carter-Wegman construction, a 2-universal hash function can be uniquely represented by two integers &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt;, which can be stored in two entries (or just one, if the word length is sufficiently large) of the table.&lt;br /&gt;
&lt;br /&gt;
Our discussion is now focused on the second condition. We find that it relies on the &#039;&#039;perfectness&#039;&#039; of the hash function for a data set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
A hash function &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; is &#039;&#039;&#039;perfect&#039;&#039;&#039; for a set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; of items if &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; maps all items in &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; to different values, i.e. there is no collision.&lt;br /&gt;
&lt;br /&gt;
We have shown by the birthday problem for 2-universal hashing that when &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; items are mapped to &amp;lt;math&amp;gt;n^2&amp;lt;/math&amp;gt; values, for an &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; chosen uniformly from a 2-universal family of hash functions, the probability that a collision occurs is at most 1/2. Thus&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\Pr[h\mbox{ is perfect for }S]\ge\frac{1}{2}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
for a table of &amp;lt;math&amp;gt;n^2&amp;lt;/math&amp;gt; entries.&lt;br /&gt;
&lt;br /&gt;
The construction of perfect hashing is straightforward then:&lt;br /&gt;
:For a set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; elements:&lt;br /&gt;
# uniformly choose an &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; from a 2-universal family &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt;; (for Carter-Wegman&#039;s construction, it means uniformly choose two integer &amp;lt;math&amp;gt;1\le a\le p-1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;b\in[p]&amp;lt;/math&amp;gt; for a sufficiently large prime &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.)&lt;br /&gt;
# check whether &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; is perfect for &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;;&lt;br /&gt;
# if &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; is NOT perfect for &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;, start over again; otherwise, construct the table;&lt;br /&gt;
&lt;br /&gt;
This is a Las Vegas randomized algorithm, which construct a perfect hashing for a fixed set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; with expectedly at most two trials (due to geometric distribution). The resulting data structure is a &amp;lt;math&amp;gt;O(n^2)&amp;lt;/math&amp;gt;-size static dictionary of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; elements which answers every search in deterministic &amp;lt;math&amp;gt;O(1)&amp;lt;/math&amp;gt; time.&lt;br /&gt;
&lt;br /&gt;
== FKS perfect hashing ==&lt;br /&gt;
In the last section we see how to use &amp;lt;math&amp;gt;O(n^2)&amp;lt;/math&amp;gt; space and constant time for answering search in a set. Now we see how to do it with linear space and constant time. This solves the problem of searching asymptotically optimal for both time and space.&lt;br /&gt;
&lt;br /&gt;
This was once seemingly impossible, until Yao&#039;s seminal paper:&lt;br /&gt;
*Yao. Should tables be sorted? &#039;&#039;Journal of the ACM (JACM)&#039;&#039;, 1981.&lt;br /&gt;
&lt;br /&gt;
Yao&#039;s paper shows a possibility of achieving linear space and constant time at the same time by exploiting the power of hashing, but assumes an unrealistically large universe. &lt;br /&gt;
&lt;br /&gt;
Inspired by Yao&#039;s work, Fredman, Komlós, and Szemerédi discover the first linear-space and constant-time static dictionary in a realistic setting: &lt;br /&gt;
* Fredman, Komlós, and Szemerédi. Storing a sparse table with O(1) worst case access time. &#039;&#039;Journal of the ACM (JACM)&#039;&#039;, 1984.&lt;br /&gt;
&lt;br /&gt;
The idea of FKS hashing is to arrange hash table in two levels:&lt;br /&gt;
* In the first level, &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; items are hashed to &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; &#039;&#039;buckets&#039;&#039; by a 2-universal hash function &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt;. &lt;br /&gt;
: Let &amp;lt;math&amp;gt;B_i&amp;lt;/math&amp;gt; be the set of items hashed to the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;th bucket.&lt;br /&gt;
* In the second level, construct a &amp;lt;math&amp;gt;|B_i|^2&amp;lt;/math&amp;gt;-size perfect hashing for each bucket &amp;lt;math&amp;gt;B_i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The data structure can be stored in a table. The first few entries are reserved to store the primary hash function &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt;. To help the searching algorithm locate a bucket, we use the next &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; entries of the table as the &amp;quot;pointers&amp;quot; to the bucket: each entry stores the address of the first entry of the space to store a bucket. In the rest of table, the &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; buckets are stored in order, each using a &amp;lt;math&amp;gt;|B_i|^2&amp;lt;/math&amp;gt; space as required by perfect hashing.&lt;br /&gt;
&lt;br /&gt;
::[[File:FKS.png|600px]]&lt;br /&gt;
&lt;br /&gt;
It is easy to see that the search time is constant. To search for an item &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt;, the algorithm does the followings:&lt;br /&gt;
* Retrieve &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt;.&lt;br /&gt;
* Retrieve the address for bucket &amp;lt;math&amp;gt;h(x)&amp;lt;/math&amp;gt;.&lt;br /&gt;
* Search by perfect hashing within bucket &amp;lt;math&amp;gt;h(x)&amp;lt;/math&amp;gt;.&lt;br /&gt;
Each line takes constant time. So the worst-case search time is constant.&lt;br /&gt;
&lt;br /&gt;
We then need to guarantee that the space is linear to &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;. At the first glance, this seems impossible because each instance of perfect hashing for a bucket costs a square-size of space. We will prove that although the individual buckets use square-sized spaces, the sum of the them is still linear.&lt;br /&gt;
&lt;br /&gt;
For a fixed set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; items, for a hash function &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; chosen uniformly from a 2-universe family which maps the items to &amp;lt;math&amp;gt;[n]&amp;lt;/math&amp;gt;, called &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; &#039;&#039;buckets&#039;&#039;,  let &amp;lt;math&amp;gt;Y_i=|B_i|&amp;lt;/math&amp;gt; be the number of items in &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; mapped to the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;th bucket.&lt;br /&gt;
We are going to bound the following quantity:&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
Y=\sum_{i=1}^n Y_i^2.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
Since each bucket &amp;lt;math&amp;gt;B_i&amp;lt;/math&amp;gt; use a space of &amp;lt;math&amp;gt;Y_i^2&amp;lt;/math&amp;gt; for perfect hashing. &amp;lt;math&amp;gt;Y&amp;lt;/math&amp;gt; gives the size of the space for storing the buckets. &lt;br /&gt;
&lt;br /&gt;
We will show that &amp;lt;math&amp;gt;Y&amp;lt;/math&amp;gt; is related to the total number of collision pairs. (Indeed, the number of collision pairs can be computed by a degree-2 polynomial, just like &amp;lt;math&amp;gt;Y&amp;lt;/math&amp;gt;.)&lt;br /&gt;
&lt;br /&gt;
Note that a bucket of &amp;lt;math&amp;gt;Y_i&amp;lt;/math&amp;gt; items contributes &amp;lt;math&amp;gt;{Y_i\choose 2}&amp;lt;/math&amp;gt; collision pairs. Let &amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt; be the total number of collision pairs.&lt;br /&gt;
&amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt; can be computed by summing over the collision pairs in every bucket:&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
X=\sum_{i=1}^n{Y_i\choose 2}=\sum_{i=1}^n\frac{Y_i(Y_i-1)}{2}=\frac{1}{2}\left(\sum_{i=1}^nY_i^2-\sum_{i=1}^nY_i\right)=\frac{1}{2}\left(\sum_{i=1}^nY_i^2-n\right).&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Therefore, the sum of squares of the sizes of buckets is related to collision number by:&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\sum_{i=1}^nY_i^2=2X+n.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
By our analysis of the collision number, we know that for &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; items mapped to &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; buckets, the expected number of collision pairs is: &amp;lt;math&amp;gt;\mathbf{E}[X]\le \frac{n}{2}&amp;lt;/math&amp;gt;.&lt;br /&gt;
Thus,&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\mathbf{E}\left[\sum_{i=1}^nY_i^2\right]=\mathbf{E}[2X+n]\le 2n.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
Due to Markov&#039;s inequality, &amp;lt;math&amp;gt;\sum_{i=1}^nY_i^2=O(n)&amp;lt;/math&amp;gt; with a constant probability. For any set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;, we can find a suitable &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; after expected constant number of trials, and FKS can be constructed with guaranteed (instead of expected) linear-size which answers each search in constant time.&lt;br /&gt;
&lt;br /&gt;
== Bloom filter ==&lt;br /&gt;
Now we consider the lossy representation of the original data set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;, to further save the space usage. Such lossy data structure is sometimes called a &#039;&#039;&#039;&#039;&#039;sketch&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The Bloom filter is such a lossy data structure. It is a space-efficient hash table that solves the &#039;&#039;&#039;approximate membership&#039;&#039;&#039; problem with one-sided error (&#039;&#039;false positive&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
Given a set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; elements from a universe &amp;lt;math&amp;gt;U&amp;lt;/math&amp;gt;, a Bloom filter consists of an array &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;cn&amp;lt;/math&amp;gt; bits, and &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; hash functions &amp;lt;math&amp;gt;h_1,h_2,\ldots,h_k&amp;lt;/math&amp;gt; map &amp;lt;math&amp;gt;U&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;[cn]&amp;lt;/math&amp;gt;, where both &amp;lt;math&amp;gt;c&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; are parameters that we can try to optimize later.&lt;br /&gt;
&lt;br /&gt;
As before, we assume the &#039;&#039;&#039;Uniform Hash Assumption (UHA)&#039;&#039;&#039;: &amp;lt;math&amp;gt;h_1,h_2,\ldots,h_k&amp;lt;/math&amp;gt; are mutually independent hash function where each &amp;lt;math&amp;gt;h_i&amp;lt;/math&amp;gt; is a uniform random hash function &amp;lt;math&amp;gt;h_i:U\to[cn]&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The Bloom filter works as follows:&lt;br /&gt;
{{Theorem|&#039;&#039;Bloom filter&#039;&#039; (Bloom 1970)|&lt;br /&gt;
:Suppose &amp;lt;math&amp;gt;h_1,h_2,\ldots,h_k:U\to[cn]&amp;lt;/math&amp;gt; are uniform and independent random hash functions.&lt;br /&gt;
-----&lt;br /&gt;
:&#039;&#039;&#039;Data structure construction:&#039;&#039;&#039; Given a set &amp;lt;math&amp;gt;S\subset U&amp;lt;/math&amp;gt; of size &amp;lt;math&amp;gt;n=|S|&amp;lt;/math&amp;gt;, the data structure is a Boolean array &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;cn&amp;lt;/math&amp;gt; bits constructed as&lt;br /&gt;
:* initialize all &amp;lt;math&amp;gt;cn&amp;lt;/math&amp;gt; bits of the Boolean array &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; to 0;&lt;br /&gt;
:* for each &amp;lt;math&amp;gt;x\in S&amp;lt;/math&amp;gt;, let &amp;lt;math&amp;gt;A[h_i(x)]=1&amp;lt;/math&amp;gt; for all &amp;lt;math&amp;gt;1\le i\le k&amp;lt;/math&amp;gt;.&lt;br /&gt;
----&lt;br /&gt;
:&#039;&#039;&#039;Query resolution:&#039;&#039;&#039; Upon each query of an arbitrary &amp;lt;math&amp;gt;x\in U&amp;lt;/math&amp;gt;,&lt;br /&gt;
:* answer &amp;quot;yes&amp;quot; if &amp;lt;math&amp;gt;A[h_i(x)]=1&amp;lt;/math&amp;gt; for all &amp;lt;math&amp;gt;1\le i\le k&amp;lt;/math&amp;gt; and &amp;quot;no&amp;quot; if otherwise.&lt;br /&gt;
}}&lt;br /&gt;
The Boolean array is our data structure, whose size is &amp;lt;math&amp;gt;cn&amp;lt;/math&amp;gt; bits. With Uniform Hash Assumption (UHA), the time cost of the data structure for answering each query is &amp;lt;math&amp;gt;O(k)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
When the answer returned by the algorithm is &amp;quot;no&amp;quot;, it holds that &amp;lt;math&amp;gt;A[h_i(x)]=0&amp;lt;/math&amp;gt; for some &amp;lt;math&amp;gt;1\le i\le k&amp;lt;/math&amp;gt;, in which case the query &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; must not belong to the set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;. Thus, the Bloom filter has no false negatives.&lt;br /&gt;
&lt;br /&gt;
On the other hand, when the answer returned by the algorithm is &amp;quot;yes&amp;quot;, &amp;lt;math&amp;gt;A[h_i(x)]=1&amp;lt;/math&amp;gt; for all &amp;lt;math&amp;gt;1\le i\le k&amp;lt;/math&amp;gt;. It is still possible for some  &amp;lt;math&amp;gt;x\not\in S&amp;lt;/math&amp;gt; that all bits  &amp;lt;math&amp;gt;A[h_i(x)]&amp;lt;/math&amp;gt; are set by elements in &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;. We want to bound such false positive, that is, the following probability for an  &amp;lt;math&amp;gt;x\not\in S&amp;lt;/math&amp;gt;:&lt;br /&gt;
:&amp;lt;math&amp;gt;\Pr[\,\forall 1\le i\le k, A[h_i(x)]=1\,]&amp;lt;/math&amp;gt;,&lt;br /&gt;
which by independence between different hash functions and by symmetry is equal to:&lt;br /&gt;
:&amp;lt;math&amp;gt;\Pr[\, A[h_1(x)]=1\,]^k=(1-\Pr[\, A[h_1(x)]=0\,])^k&amp;lt;/math&amp;gt;.&lt;br /&gt;
For an element &amp;lt;math&amp;gt;x\not\in S&amp;lt;/math&amp;gt;, its hash value &amp;lt;math&amp;gt;h_1(x)&amp;lt;/math&amp;gt; is independent of all hash values &amp;lt;math&amp;gt;h_i(y)&amp;lt;/math&amp;gt; for all &amp;lt;math&amp;gt;1\le i\le k&amp;lt;/math&amp;gt; and all &amp;lt;math&amp;gt;y\in S&amp;lt;/math&amp;gt;. This is due to the Uniform Hash Assumption. The hash value &amp;lt;math&amp;gt;h_1(x)&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;x\not\in S&amp;lt;/math&amp;gt; is then independent of the content of the array &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt;. Therefore, the probability of this position &amp;lt;math&amp;gt;A[h_1(x)]&amp;lt;/math&amp;gt; missed by all &amp;lt;math&amp;gt;kn&amp;lt;/math&amp;gt; updates to the Boolean array &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; caused by all &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; elements in &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; is:&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\Pr[\, A[h_1(x)]=0\,]=\left(1-\frac{1}{cn}\right)^{kn}\approx e^{-k/c}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Putting everything together, for any &amp;lt;math&amp;gt;x\not\in S&amp;lt;/math&amp;gt;, the false positive is bounded as:&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{align}&lt;br /&gt;
\Pr[\,\text{wrongly answer &#039;&#039;yes&#039;&#039;}\,]&lt;br /&gt;
&amp;amp;=\Pr[\,\forall 1\le i\le k, A[h_i(x)]=1\,]\\&lt;br /&gt;
&amp;amp;=\Pr[\, A[h_1(x)]=1\,]^k=(1-\Pr[\, A[h_1(x)]=0\,])^k\\&lt;br /&gt;
&amp;amp;=\left(1-\left(1-\frac{1}{cn}\right)^{kn}\right)^k\\&lt;br /&gt;
&amp;amp;\approx \left(1- e^{-k/c}\right)^k&lt;br /&gt;
\end{align}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
which is &amp;lt;math&amp;gt;(0.6185)^c&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;k=c\ln 2&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Bloom filter solves the membership query with a small constant error of false positives using a data structure of &amp;lt;math&amp;gt;O(n)&amp;lt;/math&amp;gt; bits which answers each query with &amp;lt;math&amp;gt;O(1)&amp;lt;/math&amp;gt; time cost.&lt;br /&gt;
&lt;br /&gt;
=Distinct Elements=&lt;br /&gt;
Consider the following problem of &#039;&#039;&#039;counting distinct elements&#039;&#039;&#039;: Suppose that &amp;lt;math&amp;gt;U&amp;lt;/math&amp;gt; is a sufficiently large universe.&lt;br /&gt;
*&#039;&#039;&#039;Input:&#039;&#039;&#039; a sequence of (not necessarily distinct) elements &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_n\in U&amp;lt;/math&amp;gt;;&lt;br /&gt;
*&#039;&#039;&#039;Output:&#039;&#039;&#039; an estimation of the total number of distinct elements &amp;lt;math&amp;gt;z=|\{x_1,x_2,\ldots,x_n\}|&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
A straightforward way of solving this problem is to maintain a dictionary data structure, which costs at least linear (&amp;lt;math&amp;gt;O(n)&amp;lt;/math&amp;gt;) space. For &#039;&#039;big data&#039;&#039;, where &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is very large, this is still too expensive. However, due to an information-theoretical argument, linear space is necessary if you want to compute the &#039;&#039;exact&#039;&#039; value of &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Our goal is to relax the problem a little bit to significantly reduce the space cost by tolerating &#039;&#039;approximate&#039;&#039; answers. The form of approximation we consider is &#039;&#039;&#039;&amp;lt;math&amp;gt;(\epsilon,\delta)&amp;lt;/math&amp;gt;-estimator&#039;&#039;&#039;.&lt;br /&gt;
{{Theorem|&amp;lt;math&amp;gt;(\epsilon,\delta)&amp;lt;/math&amp;gt;-estimator|&lt;br /&gt;
: A random variable &amp;lt;math&amp;gt;\widehat{Z}&amp;lt;/math&amp;gt; is an &#039;&#039;&#039;&amp;lt;math&amp;gt;(\epsilon,\delta)&amp;lt;/math&amp;gt;-estimator&#039;&#039;&#039; of a quantity &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; if&lt;br /&gt;
::&amp;lt;math&amp;gt;\Pr[\,(1-\epsilon)z\le \widehat{Z}\le (1+\epsilon)z\,]\ge 1-\delta&amp;lt;/math&amp;gt;.&lt;br /&gt;
: &amp;lt;math&amp;gt;\widehat{Z}&amp;lt;/math&amp;gt; is said to be an &#039;&#039;&#039;unbiased estimator&#039;&#039;&#039; of &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt;\mathbb{E}[\widehat{Z}]=z&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
Usually &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; is called &#039;&#039;&#039;approximation error&#039;&#039;&#039; and &amp;lt;math&amp;gt;\delta&amp;lt;/math&amp;gt; is called &#039;&#039;&#039;confidence error&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
We now present an elegant algorithm. The algorithm can be implemented in [https://en.wikipedia.org/wiki/Streaming_algorithm &#039;&#039;&#039;data stream model&#039;&#039;&#039;]: The input elements &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_n&amp;lt;/math&amp;gt; is presented to the algorithm one at a time, where the size of data &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is unknown to the algorithm. The algorithm maintains a value &amp;lt;math&amp;gt;\widehat{Z}&amp;lt;/math&amp;gt; which is an &amp;lt;math&amp;gt;(\epsilon,\delta)&amp;lt;/math&amp;gt;-estimator of the total number of distinct elements &amp;lt;math&amp;gt;z=|\{x_1,x_2,\ldots,x_n\}|&amp;lt;/math&amp;gt;, using only a small amount of memory space to memorize (with loss) the data set &amp;lt;math&amp;gt;\{x_1,x_2,\ldots,x_n\}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
A famous quotation of Flajolet describes the performance of this algorithm as:&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;Using only memory equivalent to 5 lines of printed text, you can estimate with a typical accuracy of 5% and in a single pass the total vocabulary of Shakespeare.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== The &amp;lt;math&amp;gt;\min&amp;lt;/math&amp;gt;-sketch ==&lt;br /&gt;
Suppose that we can access to an idealized random hash function &amp;lt;math&amp;gt;h:U\to[0,1]&amp;lt;/math&amp;gt; which is uniformly distributed over all mappings from the universe &amp;lt;math&amp;gt;U&amp;lt;/math&amp;gt; to unit interval &amp;lt;math&amp;gt;[0,1]&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Recall that the input sequence &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_n\in U&amp;lt;/math&amp;gt; consists of &amp;lt;math&amp;gt;z=|\{x_1,x_2,\ldots,x_n\}|&amp;lt;/math&amp;gt; distinct elements. These elements are mapped by the random function &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; hash values uniformly and independently distributed in &amp;lt;math&amp;gt;[0,1]&amp;lt;/math&amp;gt;. We could maintain these hash values instead of the original elements, but this would still be too expensive because in the worst case we still have up to &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; distinct values to maintain. However, due to the idealized random hash function, the unit interval &amp;lt;math&amp;gt;[0,1]&amp;lt;/math&amp;gt; will be partitioned into &amp;lt;math&amp;gt;z+1&amp;lt;/math&amp;gt; subintervals by these &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; uniform and independent hash values. The typical length of the subinterval gives an estimation of the number &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{{Theorem|Proposition|&lt;br /&gt;
:&amp;lt;math&amp;gt;\mathbb{E}\left[\min_{1\le i\le n}h(x_i)\right]=\frac{1}{z+1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
{{Proof|&lt;br /&gt;
The input sequence &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_n\in U&amp;lt;/math&amp;gt; consisting of &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; distinct elements are mapped to &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; random hash values uniformly and independently distributed in &amp;lt;math&amp;gt;[0,1]&amp;lt;/math&amp;gt;. These &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; hash values partition the unit interval &amp;lt;math&amp;gt;[0,1]&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;z+1&amp;lt;/math&amp;gt; subintervals &amp;lt;math&amp;gt;[0,v_1],[v_1,v_2],[v_2,v_3]\ldots,[v_{z-1},v_z],[v_z,1]&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;v_i&amp;lt;/math&amp;gt; denotes the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th smallest value among all hash values &amp;lt;math&amp;gt;\{h(x_1),h(x_2),\ldots,h(x_n)\}&amp;lt;/math&amp;gt;. Clearly we have &lt;br /&gt;
:&amp;lt;math&amp;gt;v_1=\min_{1\le i\le n}h(x_i)&amp;lt;/math&amp;gt;. &lt;br /&gt;
Meanwhile, since all hash values are uniformly and independently distributed in &amp;lt;math&amp;gt;[0,1]&amp;lt;/math&amp;gt;, the lengths of all subintervals &amp;lt;math&amp;gt;v_1, v_2-v_1, v_3-v_2,\ldots, v_z-v_{z-1}, 1-v_z&amp;lt;/math&amp;gt; are identically distributed. By symmetry, they have the same expectation, therefore&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
(z+1)\mathbb{E}[v_1]=&lt;br /&gt;
\mathbb{E}[v_1]+\sum_{i=1}^{z-1}\mathbb{E}[v_{i+1}-v_i]+\mathbb{E}[1-v_z]&lt;br /&gt;
=\mathbb{E}\left[v_1+(v_2-v_1)+(v_3-v_2)+\cdots+(v_{z}-v_{z-1})+1-v_z\right]&lt;br /&gt;
=1,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
which implies that&lt;br /&gt;
:&amp;lt;math&amp;gt;\mathbb{E}\left[\min_{1\le i\le n}h(x_i)\right]=\mathbb{E}[v_1]=\frac{1}{z+1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The quantity &amp;lt;math&amp;gt;\min_{1\le i\le n}h(x_i)&amp;lt;/math&amp;gt; can be computed with small space cost (for storing the current smallest hash value) by scan the input sequence in a single pass. Because as we proved its expectation is &amp;lt;math&amp;gt;\frac{1}{z+1}&amp;lt;/math&amp;gt;, the smallest hash value &amp;lt;math&amp;gt;Y=\min_{1\le i\le n}h(x_i)&amp;lt;/math&amp;gt; gives an unbiased estimator for &amp;lt;math&amp;gt;\frac{1}{z+1}&amp;lt;/math&amp;gt;. However, &amp;lt;math&amp;gt;\frac{1}{Y}-1&amp;lt;/math&amp;gt; is not necessarily a good estimator for &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt;. Actually, it is a rather poor estimator. Consider for example when &amp;lt;math&amp;gt;z=1&amp;lt;/math&amp;gt;, all input elements are the same. In this case, there is only one hash value and &amp;lt;math&amp;gt;Y=\min_{1\le i\le n}h(x_i)&amp;lt;/math&amp;gt; is distributed uniformly over &amp;lt;math&amp;gt;[0,1]&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;\frac{1}{Y}-1&amp;lt;/math&amp;gt; fails to be close enough to the correct answer 1 with high probability.&lt;br /&gt;
&lt;br /&gt;
==Apply the mean trick to the &amp;lt;math&amp;gt;\min&amp;lt;/math&amp;gt;-sketch==&lt;br /&gt;
The reason that the above estimator of a single hash function performs poorly is that the unbiased estimator &amp;lt;math&amp;gt;\min_{1\le i\le n}h(x_i)&amp;lt;/math&amp;gt; has large variance. So a natural way to reduce this variance is to have multiple independent hash functions and take the average. This generic approach for reducing the variance is called &#039;&#039;&#039;the mean trick&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
Suppose that we can access to &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; independent random hash functions &amp;lt;math&amp;gt;h_1,h_2,\ldots,h_k&amp;lt;/math&amp;gt;, where each &amp;lt;math&amp;gt;h_j: U\to[0,1]&amp;lt;/math&amp;gt; is uniformly and independently distributed over all functions mapping &amp;lt;math&amp;gt;U&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;[0,1]&amp;lt;/math&amp;gt;. Here &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; is a parameter to be fixed by the desired approximation error &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; and confidence error &amp;lt;math&amp;gt;\delta&amp;lt;/math&amp;gt;. The &#039;&#039;&amp;lt;math&amp;gt;\min&amp;lt;/math&amp;gt;-sketch algorithm&#039;&#039; (using the mean trick) is given by the following pseudocode.&lt;br /&gt;
&lt;br /&gt;
{{Theorem|The &amp;lt;math&amp;gt;\min&amp;lt;/math&amp;gt;-sketch|&lt;br /&gt;
:Suppose that &amp;lt;math&amp;gt;h_1,h_2,\ldots,h_k: U\to[0,1]&amp;lt;/math&amp;gt; are &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; uniform and independent random hash functions, where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; is a parameter to be fixed later.&lt;br /&gt;
-----&lt;br /&gt;
:Scan the input sequence &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_n\in U&amp;lt;/math&amp;gt; in a single pass to compute:&lt;br /&gt;
::* &amp;lt;math&amp;gt;Y_j=\min_{1\le i\le n}h_j(x_i)&amp;lt;/math&amp;gt; for every &amp;lt;math&amp;gt;j=1,2,\ldots,k&amp;lt;/math&amp;gt;;&lt;br /&gt;
::* average value &amp;lt;math&amp;gt;\overline{Y}=\frac{1}{k}\sum_{j=1}^kY_j&amp;lt;/math&amp;gt;;&lt;br /&gt;
:return &amp;lt;math&amp;gt;\widehat{Z}=\frac{1}{\overline{Y}}-1&amp;lt;/math&amp;gt; as the estimator.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The algorithm is easy to implement in data stream model, with a space cost of storing &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; hash values. The following theorem guarantees that the algorithm returns an &amp;lt;math&amp;gt;(\epsilon,\delta)&amp;lt;/math&amp;gt;-estimator of the total number of distinct elements for a suitable &amp;lt;math&amp;gt;k=O\left(\frac{1}{\epsilon^2\delta}\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
{{Theorem|Theorem|&lt;br /&gt;
:For any &amp;lt;math&amp;gt;\epsilon,\delta&amp;lt;1/2&amp;lt;/math&amp;gt;, if &amp;lt;math&amp;gt;k\ge\left\lceil\frac{4}{\epsilon^2\delta}\right\rceil&amp;lt;/math&amp;gt; then the output &amp;lt;math&amp;gt;\widehat{Z}&amp;lt;/math&amp;gt; always gives an &amp;lt;math&amp;gt;(\epsilon,\delta)&amp;lt;/math&amp;gt;-estimator of the correct answer &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
In the following we prove this main theorem for &amp;lt;math&amp;gt;\min&amp;lt;/math&amp;gt;-sketch algorithm. &lt;br /&gt;
&lt;br /&gt;
An obstacle to analyze the estimator &amp;lt;math&amp;gt;\widehat{Z}=\frac{1}{\overline{Y}}-1&amp;lt;/math&amp;gt; is that it is a nonlinear function of &amp;lt;math&amp;gt;\overline{Y}&amp;lt;/math&amp;gt; who is easier to analyze. Nevertheless, we observe that &amp;lt;math&amp;gt;\widehat{Z}&amp;lt;/math&amp;gt; is an &amp;lt;math&amp;gt;(\epsilon,\delta)&amp;lt;/math&amp;gt;-estimator of &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; as long as  &amp;lt;math&amp;gt;\overline{Y}&amp;lt;/math&amp;gt; is an &amp;lt;math&amp;gt;(\epsilon/2,\delta)&amp;lt;/math&amp;gt;-estimator of &amp;lt;math&amp;gt;\frac{1}{z+1}&amp;lt;/math&amp;gt;. This can be deduced by just verifying the following:&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{1-\epsilon/2}{z+1}\le \overline{Y}\le \frac{1+\epsilon/2}{z+1} \implies (1-\epsilon)z\le\frac{1}{\overline{Y}}-1\le (1+\epsilon)z&amp;lt;/math&amp;gt;,&lt;br /&gt;
for &amp;lt;math&amp;gt;\epsilon&amp;lt;\frac{1}{2}&amp;lt;/math&amp;gt;. Therefore,&lt;br /&gt;
:&amp;lt;math&amp;gt;\Pr\left[\,(1-\epsilon)z\le \widehat{Z} \le (1+\epsilon)z\,\right]\ge \Pr\left[\,\frac{1-\epsilon/2}{z+1}\le \overline{Y}\le \frac{1+\epsilon/2}{z+1}\,\right]&lt;br /&gt;
=\Pr\left[\,\left|\overline{Y}-\frac{1}{z+1}\right|\le \frac{\epsilon/2}{z+1}\,\right]&amp;lt;/math&amp;gt;.&lt;br /&gt;
It is then sufficient to show that &amp;lt;math&amp;gt;\Pr\left[\,\left|\overline{Y}-\frac{1}{z+1}\right|\le \frac{\epsilon/2}{z+1}\,\right]\ge 1-\delta&amp;lt;/math&amp;gt; for proving the main theorem above. We will see that this is equivalent to show the concentration inequality &lt;br /&gt;
:&amp;lt;math&amp;gt;\Pr\left[\,\left|\overline{Y}-\mathbb{E}\left[\overline{Y}\right]\right|\le \frac{\epsilon/2}{z+1}\,\right]\ge 1-\delta\quad\qquad({\color{red}*})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{{Theorem|Lemma|&lt;br /&gt;
:The followings hold for each &amp;lt;math&amp;gt;Y_j&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;j=1,2\ldots,k&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;\overline{Y}=\frac{1}{k}\sum_{j=1}^kY_j&amp;lt;/math&amp;gt;:&lt;br /&gt;
:*&amp;lt;math&amp;gt;\mathbb{E}\left[\overline{Y}\right]=\mathbb{E}\left[Y_j\right]=\frac{1}{z+1}&amp;lt;/math&amp;gt;;&lt;br /&gt;
:*&amp;lt;math&amp;gt;\mathbf{Var}\left[Y_j\right]\le\frac{1}{(z+1)^2}&amp;lt;/math&amp;gt;, and consequently &amp;lt;math&amp;gt;\mathbf{Var}\left[\overline{Y}\right]\le\frac{1}{k(z+1)^2}&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
{{Proof|&lt;br /&gt;
As in the case of single hash function, by symmetry it holds that &amp;lt;math&amp;gt;\mathbb{E}[Y_j]=\frac{1}{z+1}&amp;lt;/math&amp;gt; for every &amp;lt;math&amp;gt;j=1,2,\ldots,k&amp;lt;/math&amp;gt;. Therefore,&lt;br /&gt;
:&amp;lt;math&amp;gt;\mathbb{E}\left[\overline{Y}\right]=\frac{1}{k}\sum_{j=1}^k\mathbb{E}[Y_j]=\frac{1}{z+1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
Recall that each &amp;lt;math&amp;gt;Y_j&amp;lt;/math&amp;gt; is the minimum of &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; random hash values uniformly and independently distributed over &amp;lt;math&amp;gt;[0,1]&amp;lt;/math&amp;gt;. By geometry probability, it holds that for any &amp;lt;math&amp;gt;y\in[0,1]&amp;lt;/math&amp;gt;,&lt;br /&gt;
:&amp;lt;math&amp;gt;\Pr[Y_j&amp;gt;y]=(1-y)^z&amp;lt;/math&amp;gt;,&lt;br /&gt;
which means &amp;lt;math&amp;gt;\Pr[Y_j\le y]=1-(1-y)^z&amp;lt;/math&amp;gt;. Taking the derivative with respect to &amp;lt;math&amp;gt;y&amp;lt;/math&amp;gt;, we obtain the probability density function of random variable &amp;lt;math&amp;gt;Y_j&amp;lt;/math&amp;gt;, which is &amp;lt;math&amp;gt;z(1-y)^{z-1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We then compute the second moment.&lt;br /&gt;
:&amp;lt;math&amp;gt;\mathbb{E}[Y_j^2]=\int^{1}_0y^2z(1-y)^{z-1}\,\mathrm{d}y=\frac{2}{(z+1)(z+2)}&amp;lt;/math&amp;gt;.&lt;br /&gt;
The variance is bounded as&lt;br /&gt;
:&amp;lt;math&amp;gt;\mathbf{Var}\left[Y_j\right]=\mathbb{E}\left[Y_j^2\right]-\mathbb{E}\left[Y_j\right]^2=\frac{2}{(z+1)(z+2)}-\frac{1}{(z+1)^2}\le\frac{1}{(z+1)^2}&amp;lt;/math&amp;gt;.&lt;br /&gt;
Due to the (pairwise) independence between &amp;lt;math&amp;gt;Y_j&amp;lt;/math&amp;gt;&#039;s,&lt;br /&gt;
::&amp;lt;math&amp;gt;\mathbf{Var}\left[\overline{Y}\right]=\mathbf{Var}\left[\frac{1}{k}\sum_{j=1}^kY_j\right]=\frac{1}{k^2}\sum_{j=1}^k\mathbf{Var}\left[Y_j\right]\le \frac{1}{k(z+1)^2}&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
We resume to prove the inequality &amp;lt;math&amp;gt;({\color{red}*})&amp;lt;/math&amp;gt;. By [[高级算法_(Fall 2023)/Basic_deviation_inequalities#Chebyshev.27s_inequality|Chebyshev&#039;s inequality]], it holds that &lt;br /&gt;
:&amp;lt;math&amp;gt;\Pr\left[\,\left|\overline{Y}-\mathbb{E}\left[\overline{Y}\right]\right|&amp;gt; \frac{\epsilon/2}{z+1}\,\right]&lt;br /&gt;
\le\frac{4}{\epsilon^2}(z+1)^2\mathbf{Var}\left[\overline{Y}\right]&lt;br /&gt;
\le\frac{4}{\epsilon^2k}&amp;lt;/math&amp;gt;.&lt;br /&gt;
When &amp;lt;math&amp;gt;k\ge\left\lceil\frac{4}{\epsilon^2\delta}\right\rceil&amp;lt;/math&amp;gt;, this probability is at most &amp;lt;math&amp;gt;\delta&amp;lt;/math&amp;gt;. The inequality &amp;lt;math&amp;gt;({\color{red}*})&amp;lt;/math&amp;gt; is proved. As we discussed above, this proves the above main theorem &amp;lt;math&amp;gt;\min&amp;lt;/math&amp;gt;-sketch algorithm improved by the mean trick.&lt;br /&gt;
&lt;br /&gt;
= Frequency Estimation=&lt;br /&gt;
Suppose that &amp;lt;math&amp;gt;U&amp;lt;/math&amp;gt; is the data universe. The &#039;&#039;&#039;frequency estimation&#039;&#039;&#039; problem is defined as follows.&lt;br /&gt;
*&#039;&#039;&#039;Data:&#039;&#039;&#039; a sequence of (not necessarily distinct) elements &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_n\in U&amp;lt;/math&amp;gt;;&lt;br /&gt;
*&#039;&#039;&#039;Query:&#039;&#039;&#039; an element &amp;lt;math&amp;gt;x\in U&amp;lt;/math&amp;gt;;&lt;br /&gt;
*&#039;&#039;&#039;Output:&#039;&#039;&#039; an estimation &amp;lt;math&amp;gt;\hat{f}_x&amp;lt;/math&amp;gt; of the frequency &amp;lt;math&amp;gt;f_x\triangleq|\{i\mid x_i=x\}|&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; in input data.&lt;br /&gt;
&lt;br /&gt;
We still want to give an algorithm in the data stream model: the algorithm scan the input sequence &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_n&amp;lt;/math&amp;gt; to construct a succinct data structure, such that upon each query of &amp;lt;math&amp;gt;x\in U&amp;lt;/math&amp;gt;, the algorithm returns an estimation of the frequency &amp;lt;math&amp;gt;f_x&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Clearly this problem can always be solved by storing all appeared distinct elements along with their frequencies. However, the space cost of this straightforward solution is rather high. Instead, we want to use a lossy representation (a &#039;&#039;sketch&#039;&#039;) of input data which uses significantly less space but can still answer queries with tolarable accuracy. &lt;br /&gt;
&lt;br /&gt;
Formally, upon each query of &amp;lt;math&amp;gt;x\in U&amp;lt;/math&amp;gt;, the algorithm should return an answer &amp;lt;math&amp;gt;\hat{f}_x&amp;lt;/math&amp;gt; satisfying:&lt;br /&gt;
:&amp;lt;math&amp;gt;\Pr\left[\,\left|\hat{f}_x-f_x\right|\le \epsilon n\,\right]\ge 1-\delta&amp;lt;/math&amp;gt;.&lt;br /&gt;
Note that this notion of approximation is with bounded &#039;&#039;additive&#039;&#039; error which is weaker than the notion of &amp;lt;math&amp;gt;(\epsilon,\delta)&amp;lt;/math&amp;gt;-estimator, whose error bound is &#039;&#039;multiplicative&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
With such weak accuracy guarantee, its is possible to give a succinct data structure whose size is determined only by the error bounds &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\delta&amp;lt;/math&amp;gt; but independent of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;, because only the frequencies of those &#039;&#039;&#039;heavy hitters&#039;&#039;&#039; (elements &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; with high frequencies &amp;lt;math&amp;gt;f_x&amp;gt;\epsilon n&amp;lt;/math&amp;gt;) need to be memorized, and there are at most &amp;lt;math&amp;gt;1/\epsilon&amp;lt;/math&amp;gt; many such heavy hitters.&lt;br /&gt;
&lt;br /&gt;
== Count-min sketch==&lt;br /&gt;
The [https://en.wikipedia.org/wiki/Count–min_sketch count-min sketch] given by Cormode and Muthukrishnan is an elegant data structure for frequency estimation.&lt;br /&gt;
&lt;br /&gt;
The data structure is a two-dimensional &amp;lt;math&amp;gt;k\times m&amp;lt;/math&amp;gt; integer array, where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; are two parameters to be determined by the error bounds &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\delta&amp;lt;/math&amp;gt;. We still adopt the Uniform Hash Assumption to assume that we have access to &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; mutually independent uniform random hash functions &amp;lt;math&amp;gt;h_1,h_2,\ldots,h_k: U\to[m]&amp;lt;/math&amp;gt;.&lt;br /&gt;
{{Theorem|&#039;&#039;Count-min sketch&#039;&#039; (Cormode and Muthukrishnan 2003)|&lt;br /&gt;
:Suppose &amp;lt;math&amp;gt;h_1,h_2,\ldots,h_k: U\to[m]&amp;lt;/math&amp;gt; are uniform and independent random hash functions.&lt;br /&gt;
-----&lt;br /&gt;
:&#039;&#039;&#039;Data structure construction:&#039;&#039;&#039; Given a sequence &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_n\in U&amp;lt;/math&amp;gt;, the data structure is a two-dimensional &amp;lt;math&amp;gt;k\times m&amp;lt;/math&amp;gt; integer array &amp;lt;math&amp;gt;CMS[k][m]&amp;lt;/math&amp;gt; constructed as&lt;br /&gt;
:*initialize all entries of &amp;lt;math&amp;gt;CMS[k][m]&amp;lt;/math&amp;gt; to 0;&lt;br /&gt;
:*for &amp;lt;math&amp;gt;i=1,2,\ldots,n&amp;lt;/math&amp;gt;, upon receiving &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt;:&lt;br /&gt;
::: for every &amp;lt;math&amp;gt;1\le j\le k&amp;lt;/math&amp;gt;, evaluate &amp;lt;math&amp;gt;h_j(x_i)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;CMS[j][h_j(x_i)]++&amp;lt;/math&amp;gt;.&lt;br /&gt;
----&lt;br /&gt;
:&#039;&#039;&#039;Query resolution:&#039;&#039;&#039; Upon each query of an arbitrary &amp;lt;math&amp;gt;x\in U&amp;lt;/math&amp;gt;,&lt;br /&gt;
:* return &amp;lt;math&amp;gt;\hat{f}_x=\min_{1\le j\le k}CMS[j][h_j(x)]&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
It is easy to see that the space cost of count-min sketch is &amp;lt;math&amp;gt;O(km)&amp;lt;/math&amp;gt; memory words, or &amp;lt;math&amp;gt;O(km\log n)&amp;lt;/math&amp;gt; bits. Each query is answered within time cost &amp;lt;math&amp;gt;O(k)&amp;lt;/math&amp;gt;, assuming that an evaluation of hash function can be done in unit or constant time. We then analyze the error bounds.&lt;br /&gt;
&lt;br /&gt;
First, it is easy to observe that for any query &amp;lt;math&amp;gt;x\in U&amp;lt;/math&amp;gt; and every hash function &amp;lt;math&amp;gt;1\le j\le k&amp;lt;/math&amp;gt;, it always holds for the corresponding entry in the count-min sketch&lt;br /&gt;
:&amp;lt;math&amp;gt;CMS[j][h_j(x)]\ge f_x&amp;lt;/math&amp;gt;,&lt;br /&gt;
because the appearances of element &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; in the input sequence contribute at least &amp;lt;math&amp;gt;f_x&amp;lt;/math&amp;gt; to the value of &amp;lt;math&amp;gt;CMS[j][h_j(x)]&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Therefore, for any query &amp;lt;math&amp;gt;x\in U&amp;lt;/math&amp;gt; it always holds for the answer &amp;lt;math&amp;gt;\hat{f}_x=\min_{1\le j\le k}CMS[j][h_j(x)]\ge f_x&amp;lt;/math&amp;gt;, which means&lt;br /&gt;
:&amp;lt;math&amp;gt;\Pr\left[\,\left|\hat{f}_x- f_x\right|\ge\epsilon n\,\right]=\Pr\left[\,\hat{f}_x- f_x\ge\epsilon n\,\right]=\prod_{j=1}^k\Pr[\,CMS[j][h_j(x)]-f_x\ge\epsilon n\,],\quad\qquad({\color{red}\diamondsuit})&amp;lt;/math&amp;gt;&lt;br /&gt;
where the second equation is due to the mutual independence of random hash functions &amp;lt;math&amp;gt;h_1,h_2,\ldots,h_k&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
It remains to upper bound the probability &amp;lt;math&amp;gt;\Pr[\,CMS[j][h_j(x)]-f_x\ge\epsilon n\,]&amp;lt;/math&amp;gt;, which can be done by calculating the expectation of &amp;lt;math&amp;gt;CMS[j][h_j(x)]&amp;lt;/math&amp;gt;.&lt;br /&gt;
{{Theorem|Proposition|&lt;br /&gt;
:For any &amp;lt;math&amp;gt;x\in U&amp;lt;/math&amp;gt; and every &amp;lt;math&amp;gt;1\le j\le k&amp;lt;/math&amp;gt;, it holds that &amp;lt;math&amp;gt;\mathbb{E}\left[CMS[j][h_j(x)]\right]\le f_x+\frac{n}{m}&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
{{Proof|&lt;br /&gt;
The value of &amp;lt;math&amp;gt;CMS[j][h_j(x)]&amp;lt;/math&amp;gt; is constituted by the frequency &amp;lt;math&amp;gt;f_x&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and the frequencies &amp;lt;math&amp;gt;f_y&amp;lt;/math&amp;gt; of all other elements &amp;lt;math&amp;gt;y\neq x&amp;lt;/math&amp;gt; among &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_n&amp;lt;/math&amp;gt;, thus&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{align}&lt;br /&gt;
CMS[j][h_j(x)]&lt;br /&gt;
&amp;amp;=f_x+\sum_{\scriptstyle y\in\{x_1,\ldots,x_n\}\setminus\{x\}\atop\scriptstyle h_j(y)=h_j(x)} f_y\\&lt;br /&gt;
&amp;amp;=f_x+\sum_{y\in\{x_1,\ldots,x_n\}\setminus\{x\}} f_y \cdot I[h_j(y)=h_j(x)]&lt;br /&gt;
\end{align}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math&amp;gt;I[h_j(y)=h_j(x)]&amp;lt;/math&amp;gt; denotes the Boolean random variable that indicates the occurrence of event &amp;lt;math&amp;gt;h_j(y)=h_j(x)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
By linearity of expectation,&lt;br /&gt;
:&amp;lt;math&amp;gt;\mathbb{E}[CMS[j][h_j(x)]]=f_x+\sum_{y\in\{x_1,x_2,\ldots,x_n\}\setminus\{x\}} f_y \cdot \Pr[h_j(y)=h_j(x)]&amp;lt;/math&amp;gt;.&lt;br /&gt;
Due to Uniform Hash Assumption (UHA), &amp;lt;math&amp;gt;h_j: U\to[m]&amp;lt;/math&amp;gt; is a uniform random function. For any &amp;lt;math&amp;gt;y\neq x&amp;lt;/math&amp;gt;, the probability of hash collision is&lt;br /&gt;
:&amp;lt;math&amp;gt;\Pr[h_j(y)=h_j(x)]=\frac{1}{m}&amp;lt;/math&amp;gt;.&lt;br /&gt;
Therefore,&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{align}&lt;br /&gt;
\mathbb{E}[CMS[j][h_j(x)]]&lt;br /&gt;
&amp;amp;=f_x+\frac{1}{m}\sum_{y\in\{x_1,\ldots,x_n\}\setminus\{x\}} f_y \\&lt;br /&gt;
&amp;amp;\le f_x+\frac{1}{m}\sum_{y\in\{x_1,\ldots,x_n\}} f_y\\&lt;br /&gt;
&amp;amp;=f_x+\frac{n}{m},&lt;br /&gt;
\end{align}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where the last equation is due to the obvious identity &amp;lt;math&amp;gt;\sum_{y\in\{x_1,\ldots,x_n\}}f_y=n&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
The above proposition shows that for any &amp;lt;math&amp;gt;x\in U&amp;lt;/math&amp;gt; and every &amp;lt;math&amp;gt;1\le j\le k&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\mathbb{E}\left[CMS[j][h_j(x)]-f_x\right]\le \frac{n}{m}&amp;lt;/math&amp;gt;.&lt;br /&gt;
Recall that &amp;lt;math&amp;gt;CMS[j][h_j(x)]\ge f_x&amp;lt;/math&amp;gt; always holds, thus &amp;lt;math&amp;gt;CMS[j][h_j(x)]-f_x&amp;lt;/math&amp;gt; is a positive random variable. By Markov&#039;s inequality, we have&lt;br /&gt;
:&amp;lt;math&amp;gt;\Pr[\,CMS[j][h_j(x)]-f_x\ge\epsilon n\,]\le \frac{1}{\epsilon m}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Combining with above equation &amp;lt;math&amp;gt;({\color{red}\diamondsuit})&amp;lt;/math&amp;gt;, we have&lt;br /&gt;
:&amp;lt;math&amp;gt;\Pr\left[\,\left|\hat{f}_x- f_x\right|\ge\epsilon n\,\right]=(\Pr[\,CMS[j][h_j(x)]-f_x\ge\epsilon n\,])^k\le \frac{1}{(\epsilon m)^k}&amp;lt;/math&amp;gt;.&lt;br /&gt;
By setting &amp;lt;math&amp;gt;m=\left\lceil\frac{\mathrm{e}}{\epsilon}\right\rceil&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;k=\left\lceil\ln\frac{1}{\delta}\right\rceil&amp;lt;/math&amp;gt;, the above error probability is bounded as &amp;lt;math&amp;gt;\frac{1}{(\epsilon m)^k}\le\delta&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
For any positive &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\delta&amp;lt;/math&amp;gt;, the count-min sketch gives a data structure of size &amp;lt;math&amp;gt;O(km)=O\left(\frac{1}{\epsilon}\log\frac{1}{\delta}\right)&amp;lt;/math&amp;gt; (in memory words) and answering each query &amp;lt;math&amp;gt;x\in U&amp;lt;/math&amp;gt; in time &amp;lt;math&amp;gt;O(k)=O\left(\frac{1}{\epsilon}\right)&amp;lt;/math&amp;gt; with the following accuracy guarantee:&lt;br /&gt;
:&amp;lt;math&amp;gt;\Pr\left[\,\left|\hat{f}_x- f_x\right|\le\epsilon n\,\right]\ge 1-\delta&amp;lt;/math&amp;gt;.&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=%E9%AB%98%E7%BA%A7%E7%AE%97%E6%B3%95_(Fall_2024)/Hashing_and_Sketching&amp;diff=12635</id>
		<title>高级算法 (Fall 2024)/Hashing and Sketching</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=%E9%AB%98%E7%BA%A7%E7%AE%97%E6%B3%95_(Fall_2024)/Hashing_and_Sketching&amp;diff=12635"/>
		<updated>2024-10-02T12:19:12Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: /* Families of universal hash functions */  Add &amp;quot;distinct&amp;quot; elements in definition&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Balls into Bins=&lt;br /&gt;
The following is the so-called balls into bins model.&lt;br /&gt;
Consider throwing &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; balls into &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; bins uniformly and independently at random. This is equivalent to a random mapping &amp;lt;math&amp;gt;f:[m]\to[n]&amp;lt;/math&amp;gt;. Needless to say, random mapping is an important random model and may have many applications in Computer Science, e.g. hashing.&lt;br /&gt;
&lt;br /&gt;
We are concerned with the following three questions regarding the balls into bins model:&lt;br /&gt;
* birthday problem: the probability that every bin contains at most one ball (the mapping is 1-1);&lt;br /&gt;
* coupon collector problem: the probability that every bin contains at least one ball (the mapping is on-to);&lt;br /&gt;
* occupancy problem: the maximum load of bins.&lt;br /&gt;
&lt;br /&gt;
== Birthday Problem==&lt;br /&gt;
We now consider the &#039;&#039;&#039;birthday problem&#039;&#039;&#039;.&lt;br /&gt;
There are &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; students in the class. Assume that for each student, his/her birthday is uniformly and independently distributed over the 365 days in a years. We wonder what the probability that no two students share a birthday.&lt;br /&gt;
&lt;br /&gt;
Due to the [http://en.wikipedia.org/wiki/Pigeonhole_principle pigeonhole principle], it is obvious that for &amp;lt;math&amp;gt;m&amp;gt;365&amp;lt;/math&amp;gt;, there must be two students with the same birthday. Surprisingly, for any &amp;lt;math&amp;gt;m&amp;gt;57&amp;lt;/math&amp;gt; this event occurs with more than 99% probability. This is called the [http://en.wikipedia.org/wiki/Birthday_problem &#039;&#039;&#039;birthday paradox&#039;&#039;&#039;]. Despite the name, the birthday paradox is not a real paradox.&lt;br /&gt;
&lt;br /&gt;
We can model this problem as a balls-into-bins problem. &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; different balls (students) are uniformly and independently thrown into 365 bins (days). More generally, let &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; be the number of bins. We ask for the probability of the following event &amp;lt;math&amp;gt;\mathcal{E}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathcal{E}&amp;lt;/math&amp;gt;: there is no bin with more than one balls (i.e. no two students share birthday).&lt;br /&gt;
&lt;br /&gt;
We first analyze this by counting. There are totally &amp;lt;math&amp;gt;n^m&amp;lt;/math&amp;gt; ways of assigning &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; balls to &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; bins. The number of assignments that no two balls share a bin is &amp;lt;math&amp;gt;{n\choose m}m!&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Thus the probability is given by:&lt;br /&gt;
:&amp;lt;math&amp;gt;\begin{align}&lt;br /&gt;
\Pr[\mathcal{E}]&lt;br /&gt;
=&lt;br /&gt;
\frac{{n\choose m}m!}{n^m}.&lt;br /&gt;
\end{align}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Recall that &amp;lt;math&amp;gt;{n\choose m}=\frac{n!}{(n-m)!m!}&amp;lt;/math&amp;gt;. Then &lt;br /&gt;
:&amp;lt;math&amp;gt;\begin{align}&lt;br /&gt;
\Pr[\mathcal{E}]&lt;br /&gt;
=&lt;br /&gt;
\frac{{n\choose m}m!}{n^m}&lt;br /&gt;
=&lt;br /&gt;
\frac{n!}{n^m(n-m)!}&lt;br /&gt;
=&lt;br /&gt;
\frac{n}{n}\cdot\frac{n-1}{n}\cdot\frac{n-2}{n}\cdots\frac{n-(m-1)}{n}&lt;br /&gt;
=&lt;br /&gt;
\prod_{k=1}^{m-1}\left(1-\frac{k}{n}\right).&lt;br /&gt;
\end{align}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is also a more &amp;quot;probabilistic&amp;quot; argument for the above equation. Consider again that &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; students are mapped to &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; possible birthdays uniformly at random.&lt;br /&gt;
&lt;br /&gt;
The first student has a birthday for sure. The probability that the second student has a different birthday from the first student is &amp;lt;math&amp;gt;\left(1-\frac{1}{n}\right)&amp;lt;/math&amp;gt;. Given that the first two students have different birthdays, the probability that the third student has a different birthday from the first two students is &amp;lt;math&amp;gt;\left(1-\frac{2}{n}\right)&amp;lt;/math&amp;gt;. Continuing this on, assuming that the first &amp;lt;math&amp;gt;k-1&amp;lt;/math&amp;gt; students all have different birthdays, the probability that the &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt;th student has a different birthday than the first &amp;lt;math&amp;gt;k-1&amp;lt;/math&amp;gt;, is given by &amp;lt;math&amp;gt;\left(1-\frac{k-1}{n}\right)&amp;lt;/math&amp;gt;. By the chain rule, the probability that all &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; students have different birthdays is:&lt;br /&gt;
:&amp;lt;math&amp;gt;\begin{align}&lt;br /&gt;
\Pr[\mathcal{E}]=\left(1-\frac{1}{n}\right)\cdot \left(1-\frac{2}{n}\right)\cdots \left(1-\frac{m-1}{n}\right)&lt;br /&gt;
&amp;amp;=&lt;br /&gt;
\prod_{k=1}^{m-1}\left(1-\frac{k}{n}\right),&lt;br /&gt;
\end{align}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
which is the same as what we got by the counting argument.&lt;br /&gt;
&lt;br /&gt;
[[File:Birthday.png|border|450px|right]]&lt;br /&gt;
&lt;br /&gt;
There are several ways of analyzing this formular. Here is a convenient one: Due to [http://en.wikipedia.org/wiki/Taylor_series Taylor&#039;s expansion], &amp;lt;math&amp;gt;e^{-k/n}\approx 1-k/n&amp;lt;/math&amp;gt;. Then&lt;br /&gt;
:&amp;lt;math&amp;gt;\begin{align}&lt;br /&gt;
\prod_{k=1}^{m-1}\left(1-\frac{k}{n}\right)&lt;br /&gt;
&amp;amp;\approx&lt;br /&gt;
\prod_{k=1}^{m-1}e^{-\frac{k}{n}}\\&lt;br /&gt;
&amp;amp;=&lt;br /&gt;
\exp\left(-\sum_{k=1}^{m-1}\frac{k}{n}\right)\\&lt;br /&gt;
&amp;amp;=&lt;br /&gt;
e^{-m(m-1)/2n}\\&lt;br /&gt;
&amp;amp;\approx&lt;br /&gt;
e^{-m^2/2n}.&lt;br /&gt;
\end{align}&amp;lt;/math&amp;gt;&lt;br /&gt;
The quality of this approximation is shown in the Figure.&lt;br /&gt;
&lt;br /&gt;
Therefore, for &amp;lt;math&amp;gt;m=\sqrt{2n\ln \frac{1}{\epsilon}}&amp;lt;/math&amp;gt;, the probability that &amp;lt;math&amp;gt;\Pr[\mathcal{E}]\approx\epsilon&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Universal Hashing ==&lt;br /&gt;
Hashing is one of the oldest tools in Computer Science. Knuth&#039;s memorandum in 1963 on analysis of hash tables is now considered to be the birth of the area of analysis of algorithms.&lt;br /&gt;
* Knuth. Notes on &amp;quot;open&amp;quot; addressing, July 22 1963. Unpublished memorandum.&lt;br /&gt;
&lt;br /&gt;
The idea of hashing is simple: an unknown set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; data &#039;&#039;&#039;items&#039;&#039;&#039; (or keys) are drawn from a large &#039;&#039;&#039;universe&#039;&#039;&#039; &amp;lt;math&amp;gt;U=[N]&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;N\gg n&amp;lt;/math&amp;gt;; in order to store &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; in a table of &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; entries (slots), we assume a consistent mapping (called a &#039;&#039;&#039;hash function&#039;&#039;&#039;) from the universe &amp;lt;math&amp;gt;U&amp;lt;/math&amp;gt; to a small range &amp;lt;math&amp;gt;[M]&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
This idea seems clever: we use a consistent mapping to deal with an arbitrary unknown data set. However, there is a fundamental flaw for hashing.&lt;br /&gt;
* For sufficiently large universe (&amp;lt;math&amp;gt;N&amp;gt; M(n-1)&amp;lt;/math&amp;gt;), for any function, there exists a bad data set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;, such that all items in &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; are mapped to the same entry in the table.&lt;br /&gt;
&lt;br /&gt;
A simple use of pigeonhole principle can prove the above statement. &lt;br /&gt;
&lt;br /&gt;
To overcome this situation, randomization is introduced into hashing. We assume that the hash function is a random mapping from &amp;lt;math&amp;gt;[N]&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;[M]&amp;lt;/math&amp;gt;. In order to ease the analysis, the following ideal assumption is used:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Simple Uniform Hash Assumption&#039;&#039;&#039; (&#039;&#039;&#039;SUHA&#039;&#039;&#039; or &#039;&#039;&#039;UHA&#039;&#039;&#039;, a.k.a. the random oracle model): &lt;br /&gt;
:A &#039;&#039;uniform&#039;&#039; random function &amp;lt;math&amp;gt;h:[N]\rightarrow[M]&amp;lt;/math&amp;gt; is available and the computation of &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; is efficient.&lt;br /&gt;
&lt;br /&gt;
=== Families of universal hash functions ===&lt;br /&gt;
The assumption of completely random function simplifies the analysis.  However, in practice, truly uniform random hash function is extremely expensive to compute and store. Thus, this simple assumption can hardly represent the reality.&lt;br /&gt;
&lt;br /&gt;
There are two approaches for implementing practical hash functions. One is to use &#039;&#039;ad hoc&#039;&#039; implementations and wish they may work. The other approach is to construct class of hash functions which are efficient to compute and store but with weaker randomness guarantees, and then analyze the applications of hash functions based on this weaker assumption of randomness.&lt;br /&gt;
&lt;br /&gt;
This route was took by Carter and Wegman in 1977 while they introduced universal families of hash functions.&lt;br /&gt;
&lt;br /&gt;
{{Theorem&lt;br /&gt;
|Definition (universal hash families)|&lt;br /&gt;
:Let &amp;lt;math&amp;gt;[N]&amp;lt;/math&amp;gt; be a universe with &amp;lt;math&amp;gt;N\ge M&amp;lt;/math&amp;gt;. A family of hash functions &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;[N]&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;[M]&amp;lt;/math&amp;gt; is said to be &#039;&#039;&#039;&amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt;-universal&#039;&#039;&#039; if, for any distinct items &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_k\in [N]&amp;lt;/math&amp;gt; and for a hash function &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; chosen uniformly at random from &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt;, we have &lt;br /&gt;
::&amp;lt;math&amp;gt;&lt;br /&gt;
\Pr[h(x_1)=h(x_2)=\cdots=h(x_k)]\le\frac{1}{M^{k-1}}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:A family of hash functions &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;[N]&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;[M]&amp;lt;/math&amp;gt; is said to be &#039;&#039;&#039;strongly &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt;-universal&#039;&#039;&#039; if, for any distinct items &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_k\in [N]&amp;lt;/math&amp;gt;, any values &amp;lt;math&amp;gt;y_1,y_2,\ldots,y_k\in[M]&amp;lt;/math&amp;gt;, and for a hash function &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; chosen uniformly at random from &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt;, we have &lt;br /&gt;
::&amp;lt;math&amp;gt;&lt;br /&gt;
\Pr[h(x_1)=y_1\wedge h(x_2)=y_2 \wedge \cdots \wedge h(x_k)=y_k]=\frac{1}{M^{k}}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
In particular, for a 2-universal family &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt;, for any distinct elements &amp;lt;math&amp;gt;x_1,x_2\in[N]&amp;lt;/math&amp;gt;, a uniform random &amp;lt;math&amp;gt;h\in\mathcal{H}&amp;lt;/math&amp;gt; has&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\Pr[h(x_1)=h(x_2)]\le\frac{1}{M}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
For a strongly 2-universal family &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt;, for any distinct elements &amp;lt;math&amp;gt;x_1,x_2\in[N]&amp;lt;/math&amp;gt; and any values &amp;lt;math&amp;gt;y_1,y_2\in[M]&amp;lt;/math&amp;gt;, a uniform random &amp;lt;math&amp;gt;h\in\mathcal{H}&amp;lt;/math&amp;gt; has&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\Pr[h(x_1)=y_1\wedge h(x_2)=y_2]=\frac{1}{M^2}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
This behavior is exactly the same as uniform random hash functions on any pair of inputs. For this reason, a strongly 2-universal hash family are also called pairwise independent hash functions.&lt;br /&gt;
&lt;br /&gt;
=== 2-universal hash families ===&lt;br /&gt;
&lt;br /&gt;
The construction of pairwise independent random variables via modulo a prime introduced in Section 1 already provides a way of constructing a strongly 2-universal hash family.&lt;br /&gt;
&lt;br /&gt;
Let &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; be a prime. The function &amp;lt;math&amp;gt;h_{a,b}:[p]\rightarrow [p]&amp;lt;/math&amp;gt; is defined by&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
h_{a,b}(x)=(ax+b)\bmod p,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
and the family is&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{H}=\{h_{a,b}\mid a,b\in[p]\}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Theorem&lt;br /&gt;
|Lemma|&lt;br /&gt;
:&amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt; is strongly 2-universal.&lt;br /&gt;
}}&lt;br /&gt;
{{Proof| In Section 1, we have proved the pairwise independence of the sequence of &amp;lt;math&amp;gt;(a i+b)\bmod p&amp;lt;/math&amp;gt;, for &amp;lt;math&amp;gt;i=0,1,\ldots, p-1&amp;lt;/math&amp;gt;, which directly implies that &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt; is strongly 2-universal.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
;The original construction of Carter-Wegman&lt;br /&gt;
What if we want to have hash functions from &amp;lt;math&amp;gt;[N]&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;[M]&amp;lt;/math&amp;gt; for non-prime &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;? Carter and Wegman developed the following method.&lt;br /&gt;
&lt;br /&gt;
Suppose that the universe is &amp;lt;math&amp;gt;[N]&amp;lt;/math&amp;gt;, and the functions map &amp;lt;math&amp;gt;[N]&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;[M]&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;N\ge M&amp;lt;/math&amp;gt;. For some prime &amp;lt;math&amp;gt;p\ge N&amp;lt;/math&amp;gt;, let&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
h_{a,b}(x)=((ax+b)\bmod p)\bmod M,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
and the family&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{H}=\{h_{a,b}\mid 1\le a\le p-1, b\in[p]\}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
Note that unlike the first construction, now &amp;lt;math&amp;gt;a\neq 0&amp;lt;/math&amp;gt;.&lt;br /&gt;
{{Theorem&lt;br /&gt;
|Lemma (Carter-Wegman)|&lt;br /&gt;
:&amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt; is 2-universal.&lt;br /&gt;
}}&lt;br /&gt;
{{Proof| Due to the definition of &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt;, there are &amp;lt;math&amp;gt;p(p-1)&amp;lt;/math&amp;gt; many different hash functions in &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt;, because each hash function in &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt; corresponds to a pair of &amp;lt;math&amp;gt;1\le a\le p-1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;b\in[p]&amp;lt;/math&amp;gt;. We only need to count for any particular pair of &amp;lt;math&amp;gt;x_1,x_2\in[N]&amp;lt;/math&amp;gt; that &amp;lt;math&amp;gt;x_1\neq x_2&amp;lt;/math&amp;gt;, the number of hash functions that &amp;lt;math&amp;gt;h(x_1)=h(x_2)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We first note that for any &amp;lt;math&amp;gt;x_1\neq x_2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a x_1+b\not\equiv a x_2+b \pmod p&amp;lt;/math&amp;gt;. This is because &amp;lt;math&amp;gt;a x_1+b\equiv a x_2+b \pmod p&amp;lt;/math&amp;gt; would imply that &amp;lt;math&amp;gt;a(x_1-x_2)\equiv 0\pmod p&amp;lt;/math&amp;gt;, which can never happen since &amp;lt;math&amp;gt;1\le a\le p-1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;x_1\neq x_2&amp;lt;/math&amp;gt; (note that &amp;lt;math&amp;gt;x_1,x_2\in[N]&amp;lt;/math&amp;gt; for an &amp;lt;math&amp;gt;N\le p&amp;lt;/math&amp;gt;).  Therefore, we can assume that &amp;lt;math&amp;gt;(a x_1+b)\bmod p=u&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;(a x_2+b)\bmod p=v&amp;lt;/math&amp;gt; for &amp;lt;math&amp;gt;u\neq v&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
By linear algebra (over finite field), for any &amp;lt;math&amp;gt;x_1,x_2\in[N]&amp;lt;/math&amp;gt; that &amp;lt;math&amp;gt;x_1\neq x_2&amp;lt;/math&amp;gt;, for any &amp;lt;math&amp;gt;u,v\in[p]&amp;lt;/math&amp;gt; that &amp;lt;math&amp;gt;u\neq v&amp;lt;/math&amp;gt;, there is exact one solution to &amp;lt;math&amp;gt;(a,b)&amp;lt;/math&amp;gt; satisfying:&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{cases}&lt;br /&gt;
a x_1+b \equiv u \pmod p\\&lt;br /&gt;
a x_2+b \equiv v \pmod p.&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
After modulo &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;, every &amp;lt;math&amp;gt;u\in[p]&amp;lt;/math&amp;gt; has at most &amp;lt;math&amp;gt;\lceil p/M\rceil -1&amp;lt;/math&amp;gt; many &amp;lt;math&amp;gt;v\in[p]&amp;lt;/math&amp;gt; that &amp;lt;math&amp;gt;v\neq u&amp;lt;/math&amp;gt; but &amp;lt;math&amp;gt;v\equiv u\pmod M&amp;lt;/math&amp;gt;. Therefore, for every pair of &amp;lt;math&amp;gt;x_1,x_2\in[N]&amp;lt;/math&amp;gt; that &amp;lt;math&amp;gt;x_1\neq x_2&amp;lt;/math&amp;gt;, there exist at most &amp;lt;math&amp;gt;p(\lceil p/M\rceil -1)\le p(p-1)/M&amp;lt;/math&amp;gt; pairs of &amp;lt;math&amp;gt;1\le a\le p-1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;b\in[p]&amp;lt;/math&amp;gt; such that &amp;lt;math&amp;gt;((ax_1+b)\bmod p)\bmod M=((ax_2+b)\bmod p)\bmod M&amp;lt;/math&amp;gt;, which means there are at most &amp;lt;math&amp;gt; p(p-1)/M&amp;lt;/math&amp;gt; many hash functions &amp;lt;math&amp;gt;h\in\mathcal{H}&amp;lt;/math&amp;gt; having &amp;lt;math&amp;gt;h(x_1)=h(x_2)&amp;lt;/math&amp;gt; for &amp;lt;math&amp;gt;x_1\neq x_2&amp;lt;/math&amp;gt;. For &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; uniformly chosen from &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt;, for any &amp;lt;math&amp;gt;x_1\neq x_2&amp;lt;/math&amp;gt;,&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\Pr[h(x_1)=h(x_2)]\le \frac{p(p-1)/M}{p(p-1)}=\frac{1}{M}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
We prove that &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt; is 2-universal.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
;A construction used in practice&lt;br /&gt;
The main issue of Carter-Wegman construction is the efficiency. The mod operation is very slow, and has been so for more than 30 years.&lt;br /&gt;
&lt;br /&gt;
The following construction is due to Dietzfelbinger &#039;&#039;et al&#039;&#039;. It was published in 1997 and has been practically used in various applications of universal hashing.&lt;br /&gt;
&lt;br /&gt;
The family of hash functions is from &amp;lt;math&amp;gt;[2^u]&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;[2^v]&amp;lt;/math&amp;gt;. With a binary representation, the functions map binary strings of length &amp;lt;math&amp;gt;u&amp;lt;/math&amp;gt; to binary strings of length &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt;.&lt;br /&gt;
Let&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
h_{a}(x)=\left\lfloor\frac{a\cdot x\bmod 2^u}{2^{u-v}}\right\rfloor,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
and the family&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{H}=\{h_{a}\mid a\in[2^v]\mbox{ and }a\mbox{ is odd}\}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This family of hash functions does not exactly meet the requirement of 2-universal family. However,  Dietzfelbinger &#039;&#039;et al&#039;&#039; proved that &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt; is close to a 2-universal family. Specifically, for any input values &amp;lt;math&amp;gt;x_1,x_2\in[2^u]&amp;lt;/math&amp;gt;, for a uniformly random &amp;lt;math&amp;gt;h\in\mathcal{H}&amp;lt;/math&amp;gt;,&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\Pr[h(x_1)=h(x_2)]\le\frac{1}{2^{v-1}}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
So &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt; is within an approximation ratio of 2 to being 2-universal. The proof uses the fact that odd numbers are relative prime to a power of 2.&lt;br /&gt;
&lt;br /&gt;
The function is extremely simple to compute in c language.&lt;br /&gt;
We exploit that C-multiplication (*) of unsigned u-bit numbers is done &amp;lt;math&amp;gt;\bmod 2^u&amp;lt;/math&amp;gt;, and have a one-line C-code for computing the hash function:&lt;br /&gt;
 h_a(x) = (a*x)&amp;gt;&amp;gt;(u-v)&lt;br /&gt;
The bit-wise shifting is a lot faster than modular. It explains the popularity of this scheme in practice than the original Carter-Wegman construction.&lt;br /&gt;
&lt;br /&gt;
== Collision number ==&lt;br /&gt;
Consider a 2-universal family &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt; of hash functions from &amp;lt;math&amp;gt;[N]&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;[M]&amp;lt;/math&amp;gt;. Let &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; be a hash function chosen uniformly from &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt;. For a fixed set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; distinct elements from &amp;lt;math&amp;gt;[N]&amp;lt;/math&amp;gt;, say &amp;lt;math&amp;gt;S=\{x_1,x_2,\ldots,x_n\}&amp;lt;/math&amp;gt;, the elements are mapped to the hash values &amp;lt;math&amp;gt;h(x_1), h(x_2), \ldots, h(x_n)&amp;lt;/math&amp;gt;. This can be seen as throwing &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; balls to &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; bins, with pairwise independent choices of bins.&lt;br /&gt;
&lt;br /&gt;
As in the balls-into-bins with full independence, we are curious about the questions such as the birthday problem or the maximum load. These questions are interesting not only because they are natural to ask in a balls-into-bins setting, but in the context of hashing, they are closely related to the performance of hash functions.&lt;br /&gt;
&lt;br /&gt;
The old techniques for analyzing balls-into-bins rely too much on the independence of the choice of the bin for each ball, therefore can hardly be extended to the setting of 2-universal hash families. However, it turns out several balls-into-bins questions can somehow be answered by analyzing a very natural quantity: the number of &#039;&#039;&#039;collision pairs&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A collision pair for hashing is a pair of elements &amp;lt;math&amp;gt;x_1,x_2\in S&amp;lt;/math&amp;gt; which are mapped to the same hash value, i.e. &amp;lt;math&amp;gt;h(x_1)=h(x_2)&amp;lt;/math&amp;gt;. Formally, for a fixed set of elements &amp;lt;math&amp;gt;S=\{x_1,x_2,\ldots,x_n\}&amp;lt;/math&amp;gt;, for any &amp;lt;math&amp;gt;1\le i,j\le n&amp;lt;/math&amp;gt;, let the random variable&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
X_{ij}&lt;br /&gt;
=&lt;br /&gt;
\begin{cases}&lt;br /&gt;
1 &amp;amp; \text{if }h(x_i)=h(x_j),\\&lt;br /&gt;
0 &amp;amp; \text{otherwise.}&lt;br /&gt;
\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
The total number of collision pairs among the &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; items &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_n&amp;lt;/math&amp;gt; is &lt;br /&gt;
:&amp;lt;math&amp;gt;X=\sum_{i&amp;lt;j} X_{ij}.\,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt; is 2-universal, for any &amp;lt;math&amp;gt;i\neq j&amp;lt;/math&amp;gt;,&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\Pr[X_{ij}=1]=\Pr[h(x_i)=h(x_j)]\le\frac{1}{M}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The expected number of collision pairs is &lt;br /&gt;
:&amp;lt;math&amp;gt;\mathbf{E}[X]=\mathbf{E}\left[\sum_{i&amp;lt;j}X_{ij}\right]=\sum_{i&amp;lt;j}\mathbf{E}[X_{ij}]=\sum_{i&amp;lt;j}\Pr[X_{ij}=1]\le{n\choose 2}\frac{1}{M}&amp;lt;\frac{n^2}{2M}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In particular, for &amp;lt;math&amp;gt;n=M&amp;lt;/math&amp;gt;, i.e. &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; items are mapped to &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; hash values by a pairwise independent hash function, the expected collision number is &amp;lt;math&amp;gt;\mathbf{E}[X]&amp;lt;\frac{n^2}{2M}=\frac{n}{2}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The above analysis gives us an estimation on the expected number of collision pairs, such that &amp;lt;math&amp;gt;\mathbf{E}[X]&amp;lt;\frac{n^2}{2M}&amp;lt;/math&amp;gt;. Apply the Markov&#039;s inequality, for &amp;lt;math&amp;gt;0&amp;lt;\epsilon&amp;lt;1&amp;lt;/math&amp;gt;, we have&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\Pr\left[X\ge \frac{n^2}{2\epsilon M}\right]\le\Pr\left[X\ge \frac{1}{\epsilon}\mathbf{E}[X]\right]\le\epsilon.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;n\le\sqrt{2\epsilon M}&amp;lt;/math&amp;gt;, the number of collision pairs is &amp;lt;math&amp;gt;X\ge1&amp;lt;/math&amp;gt; with probability at most &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;, therefore with probability at least &amp;lt;math&amp;gt;1-\epsilon&amp;lt;/math&amp;gt;, there is no collision at all. Therefore, we have the following theorem.&lt;br /&gt;
{{Theorem&lt;br /&gt;
|Theorem|&lt;br /&gt;
:If &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; is chosen uniformly from a 2-universal family of hash functions mapping the universe &amp;lt;math&amp;gt;[N]&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;[M]&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;N\ge M&amp;lt;/math&amp;gt;, then for any set &amp;lt;math&amp;gt;S\subset [N]&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; items, where &amp;lt;math&amp;gt;n\le\sqrt{2\epsilon M}&amp;lt;/math&amp;gt;, the probability that there exits a collision pair is&lt;br /&gt;
::&amp;lt;math&amp;gt;&lt;br /&gt;
\Pr[\mbox{collision occurs}]\le\epsilon.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Recall that for mutually independent choices of bins, for some &amp;lt;math&amp;gt;n=\sqrt{2M\ln(1/\epsilon)}&amp;lt;/math&amp;gt;, the probability that a collision occurs is about &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;. For constant &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;, this gives an essentially same bound as the pairwise independent setting. Therefore, &lt;br /&gt;
the behavior of pairwise independent hash function is essentially the same as the uniform random hash function for the birthday problem. This is easy to understand, because birthday problem is about the behavior of collisions, and the definition of 2-universal hash function can be interpreted as &amp;quot;functions that the probability of collision is as low as a uniform random function&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
= Set  Membership=&lt;br /&gt;
A basic question in Computer Science is:&lt;br /&gt;
:&amp;quot;&amp;lt;math&amp;gt;\mbox{Is }x\in S?&amp;lt;/math&amp;gt;&amp;quot;&lt;br /&gt;
for a set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; and an element &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt;. This is the &#039;&#039;&#039;set membership&#039;&#039;&#039; problem.&lt;br /&gt;
&lt;br /&gt;
Formally, given an arbitrary set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; elements from a universe &amp;lt;math&amp;gt;U&amp;lt;/math&amp;gt;, we want to use a succinct &#039;&#039;&#039;data structure&#039;&#039;&#039; to represent this set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;, so that upon each &#039;&#039;&#039;query&#039;&#039;&#039; of any element &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; from the universe &amp;lt;math&amp;gt;[N]&amp;lt;/math&amp;gt;, the question of whether &amp;lt;math&amp;gt;x\in S&amp;lt;/math&amp;gt; is efficiently answered. The complexity of such data structure is measured in two-fold:&lt;br /&gt;
* &#039;&#039;&#039;space cost&#039;&#039;&#039;: size of the data structure to represent a set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; of size &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;;&lt;br /&gt;
* &#039;&#039;&#039;time cost&#039;&#039;&#039;: time complexity of answering each query by accessing to the data structure.&lt;br /&gt;
&lt;br /&gt;
Suppose that the universe &amp;lt;math&amp;gt;U&amp;lt;/math&amp;gt; is of size &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;. Clearly, the membership problem can be solved by a &#039;&#039;&#039;dictionary data structure&#039;&#039;&#039;, e.g.:&lt;br /&gt;
* &#039;&#039;&#039;sorted table / balanced search tree&#039;&#039;&#039;: with space cost &amp;lt;math&amp;gt;O(n\log N)&amp;lt;/math&amp;gt; bits and time cost &amp;lt;math&amp;gt;O(\log n)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Note that &amp;lt;math&amp;gt;\log{N\choose n}=\Theta\left(n\log \frac{N}{n}\right)&amp;lt;/math&amp;gt; is the entropy of sets &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; elements from a universe &amp;lt;math&amp;gt;U&amp;lt;/math&amp;gt; of size &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;. Therefore it is necessary to use so many bits to represent a set without losing any information. &lt;br /&gt;
With hashing, we can solve this fundamental problem with asymptotic optimal space cost and time cost at the same time.&lt;br /&gt;
&lt;br /&gt;
== Perfect hashing using quadratic space==&lt;br /&gt;
The idea of perfect hashing is that we use a hash function &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; to map the &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; items to distinct entries of the table; store every item &amp;lt;math&amp;gt;x\in S&amp;lt;/math&amp;gt; in the entry &amp;lt;math&amp;gt;h(x)&amp;lt;/math&amp;gt;; and also store the hash function &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; in a fixed location in the table (usually the beginning of the table). The algorithm for searching for an item is as follows:&lt;br /&gt;
&lt;br /&gt;
:search for &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; in table &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;:&lt;br /&gt;
# retrieve &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; from a fixed location in the table;&lt;br /&gt;
# if &amp;lt;math&amp;gt;x=T[h(x)]&amp;lt;/math&amp;gt; return &amp;lt;math&amp;gt;h(x)&amp;lt;/math&amp;gt;; else return NOT_FOUND;&lt;br /&gt;
&lt;br /&gt;
This scheme works as long as that the hash function satisfies the following two conditions:&lt;br /&gt;
* The description of &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; is sufficiently short, so that &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; can be stored in one entry (or in constant many entries) of the table.&lt;br /&gt;
* &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; has no collisions on &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;, i.e. there is no pair of items &amp;lt;math&amp;gt;x_1,x_2\in S&amp;lt;/math&amp;gt; that are mapped to the same value by &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The first condition is easy to guarantee for 2-universal hash families. As shown by Carter-Wegman construction, a 2-universal hash function can be uniquely represented by two integers &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt;, which can be stored in two entries (or just one, if the word length is sufficiently large) of the table.&lt;br /&gt;
&lt;br /&gt;
Our discussion is now focused on the second condition. We find that it relies on the &#039;&#039;perfectness&#039;&#039; of the hash function for a data set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
A hash function &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; is &#039;&#039;&#039;perfect&#039;&#039;&#039; for a set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; of items if &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; maps all items in &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; to different values, i.e. there is no collision.&lt;br /&gt;
&lt;br /&gt;
We have shown by the birthday problem for 2-universal hashing that when &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; items are mapped to &amp;lt;math&amp;gt;n^2&amp;lt;/math&amp;gt; values, for an &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; chosen uniformly from a 2-universal family of hash functions, the probability that a collision occurs is at most 1/2. Thus&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\Pr[h\mbox{ is perfect for }S]\ge\frac{1}{2}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
for a table of &amp;lt;math&amp;gt;n^2&amp;lt;/math&amp;gt; entries.&lt;br /&gt;
&lt;br /&gt;
The construction of perfect hashing is straightforward then:&lt;br /&gt;
:For a set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; elements:&lt;br /&gt;
# uniformly choose an &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; from a 2-universal family &amp;lt;math&amp;gt;\mathcal{H}&amp;lt;/math&amp;gt;; (for Carter-Wegman&#039;s construction, it means uniformly choose two integer &amp;lt;math&amp;gt;1\le a\le p-1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;b\in[p]&amp;lt;/math&amp;gt; for a sufficiently large prime &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.)&lt;br /&gt;
# check whether &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; is perfect for &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;;&lt;br /&gt;
# if &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; is NOT perfect for &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;, start over again; otherwise, construct the table;&lt;br /&gt;
&lt;br /&gt;
This is a Las Vegas randomized algorithm, which construct a perfect hashing for a fixed set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; with expectedly at most two trials (due to geometric distribution). The resulting data structure is a &amp;lt;math&amp;gt;O(n^2)&amp;lt;/math&amp;gt;-size static dictionary of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; elements which answers every search in deterministic &amp;lt;math&amp;gt;O(1)&amp;lt;/math&amp;gt; time.&lt;br /&gt;
&lt;br /&gt;
== FKS perfect hashing ==&lt;br /&gt;
In the last section we see how to use &amp;lt;math&amp;gt;O(n^2)&amp;lt;/math&amp;gt; space and constant time for answering search in a set. Now we see how to do it with linear space and constant time. This solves the problem of searching asymptotically optimal for both time and space.&lt;br /&gt;
&lt;br /&gt;
This was once seemingly impossible, until Yao&#039;s seminal paper:&lt;br /&gt;
*Yao. Should tables be sorted? &#039;&#039;Journal of the ACM (JACM)&#039;&#039;, 1981.&lt;br /&gt;
&lt;br /&gt;
Yao&#039;s paper shows a possibility of achieving linear space and constant time at the same time by exploiting the power of hashing, but assumes an unrealistically large universe. &lt;br /&gt;
&lt;br /&gt;
Inspired by Yao&#039;s work, Fredman, Komlós, and Szemerédi discover the first linear-space and constant-time static dictionary in a realistic setting: &lt;br /&gt;
* Fredman, Komlós, and Szemerédi. Storing a sparse table with O(1) worst case access time. &#039;&#039;Journal of the ACM (JACM)&#039;&#039;, 1984.&lt;br /&gt;
&lt;br /&gt;
The idea of FKS hashing is to arrange hash table in two levels:&lt;br /&gt;
* In the first level, &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; items are hashed to &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; &#039;&#039;buckets&#039;&#039; by a 2-universal hash function &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt;. &lt;br /&gt;
: Let &amp;lt;math&amp;gt;B_i&amp;lt;/math&amp;gt; be the set of items hashed to the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;th bucket.&lt;br /&gt;
* In the second level, construct a &amp;lt;math&amp;gt;|B_i|^2&amp;lt;/math&amp;gt;-size perfect hashing for each bucket &amp;lt;math&amp;gt;B_i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The data structure can be stored in a table. The first few entries are reserved to store the primary hash function &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt;. To help the searching algorithm locate a bucket, we use the next &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; entries of the table as the &amp;quot;pointers&amp;quot; to the bucket: each entry stores the address of the first entry of the space to store a bucket. In the rest of table, the &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; buckets are stored in order, each using a &amp;lt;math&amp;gt;|B_i|^2&amp;lt;/math&amp;gt; space as required by perfect hashing.&lt;br /&gt;
&lt;br /&gt;
::[[File:FKS.png|600px]]&lt;br /&gt;
&lt;br /&gt;
It is easy to see that the search time is constant. To search for an item &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt;, the algorithm does the followings:&lt;br /&gt;
* Retrieve &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt;.&lt;br /&gt;
* Retrieve the address for bucket &amp;lt;math&amp;gt;h(x)&amp;lt;/math&amp;gt;.&lt;br /&gt;
* Search by perfect hashing within bucket &amp;lt;math&amp;gt;h(x)&amp;lt;/math&amp;gt;.&lt;br /&gt;
Each line takes constant time. So the worst-case search time is constant.&lt;br /&gt;
&lt;br /&gt;
We then need to guarantee that the space is linear to &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;. At the first glance, this seems impossible because each instance of perfect hashing for a bucket costs a square-size of space. We will prove that although the individual buckets use square-sized spaces, the sum of the them is still linear.&lt;br /&gt;
&lt;br /&gt;
For a fixed set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; items, for a hash function &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; chosen uniformly from a 2-universe family which maps the items to &amp;lt;math&amp;gt;[n]&amp;lt;/math&amp;gt;, called &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; &#039;&#039;buckets&#039;&#039;,  let &amp;lt;math&amp;gt;Y_i=|B_i|&amp;lt;/math&amp;gt; be the number of items in &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; mapped to the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;th bucket.&lt;br /&gt;
We are going to bound the following quantity:&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
Y=\sum_{i=1}^n Y_i^2.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
Since each bucket &amp;lt;math&amp;gt;B_i&amp;lt;/math&amp;gt; use a space of &amp;lt;math&amp;gt;Y_i^2&amp;lt;/math&amp;gt; for perfect hashing. &amp;lt;math&amp;gt;Y&amp;lt;/math&amp;gt; gives the size of the space for storing the buckets. &lt;br /&gt;
&lt;br /&gt;
We will show that &amp;lt;math&amp;gt;Y&amp;lt;/math&amp;gt; is related to the total number of collision pairs. (Indeed, the number of collision pairs can be computed by a degree-2 polynomial, just like &amp;lt;math&amp;gt;Y&amp;lt;/math&amp;gt;.)&lt;br /&gt;
&lt;br /&gt;
Note that a bucket of &amp;lt;math&amp;gt;Y_i&amp;lt;/math&amp;gt; items contributes &amp;lt;math&amp;gt;{Y_i\choose 2}&amp;lt;/math&amp;gt; collision pairs. Let &amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt; be the total number of collision pairs.&lt;br /&gt;
&amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt; can be computed by summing over the collision pairs in every bucket:&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
X=\sum_{i=1}^n{Y_i\choose 2}=\sum_{i=1}^n\frac{Y_i(Y_i-1)}{2}=\frac{1}{2}\left(\sum_{i=1}^nY_i^2-\sum_{i=1}^nY_i\right)=\frac{1}{2}\left(\sum_{i=1}^nY_i^2-n\right).&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Therefore, the sum of squares of the sizes of buckets is related to collision number by:&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\sum_{i=1}^nY_i^2=2X+n.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
By our analysis of the collision number, we know that for &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; items mapped to &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; buckets, the expected number of collision pairs is: &amp;lt;math&amp;gt;\mathbf{E}[X]\le \frac{n}{2}&amp;lt;/math&amp;gt;.&lt;br /&gt;
Thus,&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\mathbf{E}\left[\sum_{i=1}^nY_i^2\right]=\mathbf{E}[2X+n]\le 2n.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
Due to Markov&#039;s inequality, &amp;lt;math&amp;gt;\sum_{i=1}^nY_i^2=O(n)&amp;lt;/math&amp;gt; with a constant probability. For any set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;, we can find a suitable &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; after expected constant number of trials, and FKS can be constructed with guaranteed (instead of expected) linear-size which answers each search in constant time.&lt;br /&gt;
&lt;br /&gt;
== Bloom filter ==&lt;br /&gt;
Now we consider the lossy representation of the original data set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;, to further save the space usage. Such lossy data structure is sometimes called a &#039;&#039;&#039;&#039;&#039;sketch&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The Bloom filter is such a lossy data structure. It is a space-efficient hash table that solves the &#039;&#039;&#039;approximate membership&#039;&#039;&#039; problem with one-sided error (&#039;&#039;false positive&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
Given a set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; elements from a universe &amp;lt;math&amp;gt;U&amp;lt;/math&amp;gt;, a Bloom filter consists of an array &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;cn&amp;lt;/math&amp;gt; bits, and &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; hash functions &amp;lt;math&amp;gt;h_1,h_2,\ldots,h_k&amp;lt;/math&amp;gt; map &amp;lt;math&amp;gt;U&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;[cn]&amp;lt;/math&amp;gt;, where both &amp;lt;math&amp;gt;c&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; are parameters that we can try to optimize later.&lt;br /&gt;
&lt;br /&gt;
As before, we assume the &#039;&#039;&#039;Uniform Hash Assumption (UHA)&#039;&#039;&#039;: &amp;lt;math&amp;gt;h_1,h_2,\ldots,h_k&amp;lt;/math&amp;gt; are mutually independent hash function where each &amp;lt;math&amp;gt;h_i&amp;lt;/math&amp;gt; is a uniform random hash function &amp;lt;math&amp;gt;h_i:U\to[cn]&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The Bloom filter works as follows:&lt;br /&gt;
{{Theorem|&#039;&#039;Bloom filter&#039;&#039; (Bloom 1970)|&lt;br /&gt;
:Suppose &amp;lt;math&amp;gt;h_1,h_2,\ldots,h_k:U\to[cn]&amp;lt;/math&amp;gt; are uniform and independent random hash functions.&lt;br /&gt;
-----&lt;br /&gt;
:&#039;&#039;&#039;Data structure construction:&#039;&#039;&#039; Given a set &amp;lt;math&amp;gt;S\subset U&amp;lt;/math&amp;gt; of size &amp;lt;math&amp;gt;n=|S|&amp;lt;/math&amp;gt;, the data structure is a Boolean array &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;cn&amp;lt;/math&amp;gt; bits constructed as&lt;br /&gt;
:* initialize all &amp;lt;math&amp;gt;cn&amp;lt;/math&amp;gt; bits of the Boolean array &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; to 0;&lt;br /&gt;
:* for each &amp;lt;math&amp;gt;x\in S&amp;lt;/math&amp;gt;, let &amp;lt;math&amp;gt;A[h_i(x)]=1&amp;lt;/math&amp;gt; for all &amp;lt;math&amp;gt;1\le i\le k&amp;lt;/math&amp;gt;.&lt;br /&gt;
----&lt;br /&gt;
:&#039;&#039;&#039;Query resolution:&#039;&#039;&#039; Upon each query of an arbitrary &amp;lt;math&amp;gt;x\in U&amp;lt;/math&amp;gt;,&lt;br /&gt;
:* answer &amp;quot;yes&amp;quot; if &amp;lt;math&amp;gt;A[h_i(x)]=1&amp;lt;/math&amp;gt; for all &amp;lt;math&amp;gt;1\le i\le k&amp;lt;/math&amp;gt; and &amp;quot;no&amp;quot; if otherwise.&lt;br /&gt;
}}&lt;br /&gt;
The Boolean array is our data structure, whose size is &amp;lt;math&amp;gt;cn&amp;lt;/math&amp;gt; bits. With Uniform Hash Assumption (UHA), the time cost of the data structure for answering each query is &amp;lt;math&amp;gt;O(k)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
When the answer returned by the algorithm is &amp;quot;no&amp;quot;, it holds that &amp;lt;math&amp;gt;A[h_i(x)]=0&amp;lt;/math&amp;gt; for some &amp;lt;math&amp;gt;1\le i\le k&amp;lt;/math&amp;gt;, in which case the query &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; must not belong to the set &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;. Thus, the Bloom filter has no false negatives.&lt;br /&gt;
&lt;br /&gt;
On the other hand, when the answer returned by the algorithm is &amp;quot;yes&amp;quot;, &amp;lt;math&amp;gt;A[h_i(x)]=1&amp;lt;/math&amp;gt; for all &amp;lt;math&amp;gt;1\le i\le k&amp;lt;/math&amp;gt;. It is still possible for some  &amp;lt;math&amp;gt;x\not\in S&amp;lt;/math&amp;gt; that all bits  &amp;lt;math&amp;gt;A[h_i(x)]&amp;lt;/math&amp;gt; are set by elements in &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;. We want to bound such false positive, that is, the following probability for an  &amp;lt;math&amp;gt;x\not\in S&amp;lt;/math&amp;gt;:&lt;br /&gt;
:&amp;lt;math&amp;gt;\Pr[\,\forall 1\le i\le k, A[h_i(x)]=1\,]&amp;lt;/math&amp;gt;,&lt;br /&gt;
which by independence between different hash functions and by symmetry is equal to:&lt;br /&gt;
:&amp;lt;math&amp;gt;\Pr[\, A[h_1(x)]=1\,]^k=(1-\Pr[\, A[h_1(x)]=0\,])^k&amp;lt;/math&amp;gt;.&lt;br /&gt;
For an element &amp;lt;math&amp;gt;x\not\in S&amp;lt;/math&amp;gt;, its hash value &amp;lt;math&amp;gt;h_1(x)&amp;lt;/math&amp;gt; is independent of all hash values &amp;lt;math&amp;gt;h_i(y)&amp;lt;/math&amp;gt; for all &amp;lt;math&amp;gt;1\le i\le k&amp;lt;/math&amp;gt; and all &amp;lt;math&amp;gt;y\in S&amp;lt;/math&amp;gt;. This is due to the Uniform Hash Assumption. The hash value &amp;lt;math&amp;gt;h_1(x)&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;x\not\in S&amp;lt;/math&amp;gt; is then independent of the content of the array &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt;. Therefore, the probability of this position &amp;lt;math&amp;gt;A[h_1(x)]&amp;lt;/math&amp;gt; missed by all &amp;lt;math&amp;gt;kn&amp;lt;/math&amp;gt; updates to the Boolean array &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; caused by all &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; elements in &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; is:&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\Pr[\, A[h_1(x)]=0\,]=\left(1-\frac{1}{cn}\right)^{kn}\approx e^{-k/c}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Putting everything together, for any &amp;lt;math&amp;gt;x\not\in S&amp;lt;/math&amp;gt;, the false positive is bounded as:&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{align}&lt;br /&gt;
\Pr[\,\text{wrongly answer &#039;&#039;yes&#039;&#039;}\,]&lt;br /&gt;
&amp;amp;=\Pr[\,\forall 1\le i\le k, A[h_i(x)]=1\,]\\&lt;br /&gt;
&amp;amp;=\Pr[\, A[h_1(x)]=1\,]^k=(1-\Pr[\, A[h_1(x)]=0\,])^k\\&lt;br /&gt;
&amp;amp;=\left(1-\left(1-\frac{1}{cn}\right)^{kn}\right)^k\\&lt;br /&gt;
&amp;amp;\approx \left(1- e^{-k/c}\right)^k&lt;br /&gt;
\end{align}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
which is &amp;lt;math&amp;gt;(0.6185)^c&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;k=c\ln 2&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Bloom filter solves the membership query with a small constant error of false positives using a data structure of &amp;lt;math&amp;gt;O(n)&amp;lt;/math&amp;gt; bits which answers each query with &amp;lt;math&amp;gt;O(1)&amp;lt;/math&amp;gt; time cost.&lt;br /&gt;
&lt;br /&gt;
=Distinct Elements=&lt;br /&gt;
Consider the following problem of &#039;&#039;&#039;counting distinct elements&#039;&#039;&#039;: Suppose that &amp;lt;math&amp;gt;U&amp;lt;/math&amp;gt; is a sufficiently large universe.&lt;br /&gt;
*&#039;&#039;&#039;Input:&#039;&#039;&#039; a sequence of (not necessarily distinct) elements &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_n\in U&amp;lt;/math&amp;gt;;&lt;br /&gt;
*&#039;&#039;&#039;Output:&#039;&#039;&#039; an estimation of the total number of distinct elements &amp;lt;math&amp;gt;z=|\{x_1,x_2,\ldots,x_n\}|&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
A straightforward way of solving this problem is to maintain a dictionary data structure, which costs at least linear (&amp;lt;math&amp;gt;O(n)&amp;lt;/math&amp;gt;) space. For &#039;&#039;big data&#039;&#039;, where &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is very large, this is still too expensive. However, due to an information-theoretical argument, linear space is necessary if you want to compute the &#039;&#039;exact&#039;&#039; value of &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Our goal is to relax the problem a little bit to significantly reduce the space cost by tolerating &#039;&#039;approximate&#039;&#039; answers. The form of approximation we consider is &#039;&#039;&#039;&amp;lt;math&amp;gt;(\epsilon,\delta)&amp;lt;/math&amp;gt;-estimator&#039;&#039;&#039;.&lt;br /&gt;
{{Theorem|&amp;lt;math&amp;gt;(\epsilon,\delta)&amp;lt;/math&amp;gt;-estimator|&lt;br /&gt;
: A random variable &amp;lt;math&amp;gt;\widehat{Z}&amp;lt;/math&amp;gt; is an &#039;&#039;&#039;&amp;lt;math&amp;gt;(\epsilon,\delta)&amp;lt;/math&amp;gt;-estimator&#039;&#039;&#039; of a quantity &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; if&lt;br /&gt;
::&amp;lt;math&amp;gt;\Pr[\,(1-\epsilon)z\le \widehat{Z}\le (1+\epsilon)z\,]\ge 1-\delta&amp;lt;/math&amp;gt;.&lt;br /&gt;
: &amp;lt;math&amp;gt;\widehat{Z}&amp;lt;/math&amp;gt; is said to be an &#039;&#039;&#039;unbiased estimator&#039;&#039;&#039; of &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt;\mathbb{E}[\widehat{Z}]=z&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
Usually &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; is called &#039;&#039;&#039;approximation error&#039;&#039;&#039; and &amp;lt;math&amp;gt;\delta&amp;lt;/math&amp;gt; is called &#039;&#039;&#039;confidence error&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
We now present an elegant algorithm. The algorithm can be implemented in [https://en.wikipedia.org/wiki/Streaming_algorithm &#039;&#039;&#039;data stream model&#039;&#039;&#039;]: The input elements &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_n&amp;lt;/math&amp;gt; is presented to the algorithm one at a time, where the size of data &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is unknown to the algorithm. The algorithm maintains a value &amp;lt;math&amp;gt;\widehat{Z}&amp;lt;/math&amp;gt; which is an &amp;lt;math&amp;gt;(\epsilon,\delta)&amp;lt;/math&amp;gt;-estimator of the total number of distinct elements &amp;lt;math&amp;gt;z=|\{x_1,x_2,\ldots,x_n\}|&amp;lt;/math&amp;gt;, using only a small amount of memory space to memorize (with loss) the data set &amp;lt;math&amp;gt;\{x_1,x_2,\ldots,x_n\}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
A famous quotation of Flajolet describes the performance of this algorithm as:&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;Using only memory equivalent to 5 lines of printed text, you can estimate with a typical accuracy of 5% and in a single pass the total vocabulary of Shakespeare.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== The &amp;lt;math&amp;gt;\min&amp;lt;/math&amp;gt;-sketch ==&lt;br /&gt;
Suppose that we can access to an idealized random hash function &amp;lt;math&amp;gt;h:U\to[0,1]&amp;lt;/math&amp;gt; which is uniformly distributed over all mappings from the universe &amp;lt;math&amp;gt;U&amp;lt;/math&amp;gt; to unit interval &amp;lt;math&amp;gt;[0,1]&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Recall that the input sequence &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_n\in U&amp;lt;/math&amp;gt; consists of &amp;lt;math&amp;gt;z=|\{x_1,x_2,\ldots,x_n\}|&amp;lt;/math&amp;gt; distinct elements. These elements are mapped by the random function &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; hash values uniformly and independently distributed in &amp;lt;math&amp;gt;[0,1]&amp;lt;/math&amp;gt;. We could maintain these hash values instead of the original elements, but this would still be too expensive because in the worst case we still have up to &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; distinct values to maintain. However, due to the idealized random hash function, the unit interval &amp;lt;math&amp;gt;[0,1]&amp;lt;/math&amp;gt; will be partitioned into &amp;lt;math&amp;gt;z+1&amp;lt;/math&amp;gt; subintervals by these &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; uniform and independent hash values. The typical length of the subinterval gives an estimation of the number &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{{Theorem|Proposition|&lt;br /&gt;
:&amp;lt;math&amp;gt;\mathbb{E}\left[\min_{1\le i\le n}h(x_i)\right]=\frac{1}{z+1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
{{Proof|&lt;br /&gt;
The input sequence &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_n\in U&amp;lt;/math&amp;gt; consisting of &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; distinct elements are mapped to &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; random hash values uniformly and independently distributed in &amp;lt;math&amp;gt;[0,1]&amp;lt;/math&amp;gt;. These &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; hash values partition the unit interval &amp;lt;math&amp;gt;[0,1]&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;z+1&amp;lt;/math&amp;gt; subintervals &amp;lt;math&amp;gt;[0,v_1],[v_1,v_2],[v_2,v_3]\ldots,[v_{z-1},v_z],[v_z,1]&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;v_i&amp;lt;/math&amp;gt; denotes the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th smallest value among all hash values &amp;lt;math&amp;gt;\{h(x_1),h(x_2),\ldots,h(x_n)\}&amp;lt;/math&amp;gt;. Clearly we have &lt;br /&gt;
:&amp;lt;math&amp;gt;v_1=\min_{1\le i\le n}h(x_i)&amp;lt;/math&amp;gt;. &lt;br /&gt;
Meanwhile, since all hash values are uniformly and independently distributed in &amp;lt;math&amp;gt;[0,1]&amp;lt;/math&amp;gt;, the lengths of all subintervals &amp;lt;math&amp;gt;v_1, v_2-v_1, v_3-v_2,\ldots, v_z-v_{z-1}, 1-v_z&amp;lt;/math&amp;gt; are identically distributed. By symmetry, they have the same expectation, therefore&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
(z+1)\mathbb{E}[v_1]=&lt;br /&gt;
\mathbb{E}[v_1]+\sum_{i=1}^{z-1}\mathbb{E}[v_{i+1}-v_i]+\mathbb{E}[1-v_z]&lt;br /&gt;
=\mathbb{E}\left[v_1+(v_2-v_1)+(v_3-v_2)+\cdots+(v_{z}-v_{z-1})+1-v_z\right]&lt;br /&gt;
=1,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
which implies that&lt;br /&gt;
:&amp;lt;math&amp;gt;\mathbb{E}\left[\min_{1\le i\le n}h(x_i)\right]=\mathbb{E}[v_1]=\frac{1}{z+1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The quantity &amp;lt;math&amp;gt;\min_{1\le i\le n}h(x_i)&amp;lt;/math&amp;gt; can be computed with small space cost (for storing the current smallest hash value) by scan the input sequence in a single pass. Because as we proved its expectation is &amp;lt;math&amp;gt;\frac{1}{z+1}&amp;lt;/math&amp;gt;, the smallest hash value &amp;lt;math&amp;gt;Y=\min_{1\le i\le n}h(x_i)&amp;lt;/math&amp;gt; gives an unbiased estimator for &amp;lt;math&amp;gt;\frac{1}{z+1}&amp;lt;/math&amp;gt;. However, &amp;lt;math&amp;gt;\frac{1}{Y}-1&amp;lt;/math&amp;gt; is not necessarily a good estimator for &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt;. Actually, it is a rather poor estimator. Consider for example when &amp;lt;math&amp;gt;z=1&amp;lt;/math&amp;gt;, all input elements are the same. In this case, there is only one hash value and &amp;lt;math&amp;gt;Y=\min_{1\le i\le n}h(x_i)&amp;lt;/math&amp;gt; is distributed uniformly over &amp;lt;math&amp;gt;[0,1]&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;\frac{1}{Y}-1&amp;lt;/math&amp;gt; fails to be close enough to the correct answer 1 with high probability.&lt;br /&gt;
&lt;br /&gt;
==Apply the mean trick to the &amp;lt;math&amp;gt;\min&amp;lt;/math&amp;gt;-sketch==&lt;br /&gt;
The reason that the above estimator of a single hash function performs poorly is that the unbiased estimator &amp;lt;math&amp;gt;\min_{1\le i\le n}h(x_i)&amp;lt;/math&amp;gt; has large variance. So a natural way to reduce this variance is to have multiple independent hash functions and take the average. This generic approach for reducing the variance is called &#039;&#039;&#039;the mean trick&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
Suppose that we can access to &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; independent random hash functions &amp;lt;math&amp;gt;h_1,h_2,\ldots,h_k&amp;lt;/math&amp;gt;, where each &amp;lt;math&amp;gt;h_j: U\to[0,1]&amp;lt;/math&amp;gt; is uniformly and independently distributed over all functions mapping &amp;lt;math&amp;gt;U&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;[0,1]&amp;lt;/math&amp;gt;. Here &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; is a parameter to be fixed by the desired approximation error &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; and confidence error &amp;lt;math&amp;gt;\delta&amp;lt;/math&amp;gt;. The &#039;&#039;&amp;lt;math&amp;gt;\min&amp;lt;/math&amp;gt;-sketch algorithm&#039;&#039; (using the mean trick) is given by the following pseudocode.&lt;br /&gt;
&lt;br /&gt;
{{Theorem|The &amp;lt;math&amp;gt;\min&amp;lt;/math&amp;gt;-sketch|&lt;br /&gt;
:Suppose that &amp;lt;math&amp;gt;h_1,h_2,\ldots,h_k: U\to[0,1]&amp;lt;/math&amp;gt; are &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; uniform and independent random hash functions, where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; is a parameter to be fixed later.&lt;br /&gt;
-----&lt;br /&gt;
:Scan the input sequence &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_n\in U&amp;lt;/math&amp;gt; in a single pass to compute:&lt;br /&gt;
::* &amp;lt;math&amp;gt;Y_j=\min_{1\le i\le n}h_j(x_i)&amp;lt;/math&amp;gt; for every &amp;lt;math&amp;gt;j=1,2,\ldots,k&amp;lt;/math&amp;gt;;&lt;br /&gt;
::* average value &amp;lt;math&amp;gt;\overline{Y}=\frac{1}{k}\sum_{j=1}^kY_j&amp;lt;/math&amp;gt;;&lt;br /&gt;
:return &amp;lt;math&amp;gt;\widehat{Z}=\frac{1}{\overline{Y}}-1&amp;lt;/math&amp;gt; as the estimator.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The algorithm is easy to implement in data stream model, with a space cost of storing &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; hash values. The following theorem guarantees that the algorithm returns an &amp;lt;math&amp;gt;(\epsilon,\delta)&amp;lt;/math&amp;gt;-estimator of the total number of distinct elements for a suitable &amp;lt;math&amp;gt;k=O\left(\frac{1}{\epsilon^2\delta}\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
{{Theorem|Theorem|&lt;br /&gt;
:For any &amp;lt;math&amp;gt;\epsilon,\delta&amp;lt;1/2&amp;lt;/math&amp;gt;, if &amp;lt;math&amp;gt;k\ge\left\lceil\frac{4}{\epsilon^2\delta}\right\rceil&amp;lt;/math&amp;gt; then the output &amp;lt;math&amp;gt;\widehat{Z}&amp;lt;/math&amp;gt; always gives an &amp;lt;math&amp;gt;(\epsilon,\delta)&amp;lt;/math&amp;gt;-estimator of the correct answer &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
In the following we prove this main theorem for &amp;lt;math&amp;gt;\min&amp;lt;/math&amp;gt;-sketch algorithm. &lt;br /&gt;
&lt;br /&gt;
An obstacle to analyze the estimator &amp;lt;math&amp;gt;\widehat{Z}=\frac{1}{\overline{Y}}-1&amp;lt;/math&amp;gt; is that it is a nonlinear function of &amp;lt;math&amp;gt;\overline{Y}&amp;lt;/math&amp;gt; who is easier to analyze. Nevertheless, we observe that &amp;lt;math&amp;gt;\widehat{Z}&amp;lt;/math&amp;gt; is an &amp;lt;math&amp;gt;(\epsilon,\delta)&amp;lt;/math&amp;gt;-estimator of &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; as long as  &amp;lt;math&amp;gt;\overline{Y}&amp;lt;/math&amp;gt; is an &amp;lt;math&amp;gt;(\epsilon/2,\delta)&amp;lt;/math&amp;gt;-estimator of &amp;lt;math&amp;gt;\frac{1}{z+1}&amp;lt;/math&amp;gt;. This can be deduced by just verifying the following:&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{1-\epsilon/2}{z+1}\le \overline{Y}\le \frac{1+\epsilon/2}{z+1} \implies (1-\epsilon)z\le\frac{1}{\overline{Y}}-1\le (1+\epsilon)z&amp;lt;/math&amp;gt;,&lt;br /&gt;
for &amp;lt;math&amp;gt;\epsilon&amp;lt;\frac{1}{2}&amp;lt;/math&amp;gt;. Therefore,&lt;br /&gt;
:&amp;lt;math&amp;gt;\Pr\left[\,(1-\epsilon)z\le \widehat{Z} \le (1+\epsilon)z\,\right]\ge \Pr\left[\,\frac{1-\epsilon/2}{z+1}\le \overline{Y}\le \frac{1+\epsilon/2}{z+1}\,\right]&lt;br /&gt;
=\Pr\left[\,\left|\overline{Y}-\frac{1}{z+1}\right|\le \frac{\epsilon/2}{z+1}\,\right]&amp;lt;/math&amp;gt;.&lt;br /&gt;
It is then sufficient to show that &amp;lt;math&amp;gt;\Pr\left[\,\left|\overline{Y}-\frac{1}{z+1}\right|\le \frac{\epsilon/2}{z+1}\,\right]\ge 1-\delta&amp;lt;/math&amp;gt; for proving the main theorem above. We will see that this is equivalent to show the concentration inequality &lt;br /&gt;
:&amp;lt;math&amp;gt;\Pr\left[\,\left|\overline{Y}-\mathbb{E}\left[\overline{Y}\right]\right|\le \frac{\epsilon/2}{z+1}\,\right]\ge 1-\delta\quad\qquad({\color{red}*})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{{Theorem|Lemma|&lt;br /&gt;
:The followings hold for each &amp;lt;math&amp;gt;Y_j&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;j=1,2\ldots,k&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;\overline{Y}=\frac{1}{k}\sum_{j=1}^kY_j&amp;lt;/math&amp;gt;:&lt;br /&gt;
:*&amp;lt;math&amp;gt;\mathbb{E}\left[\overline{Y}\right]=\mathbb{E}\left[Y_j\right]=\frac{1}{z+1}&amp;lt;/math&amp;gt;;&lt;br /&gt;
:*&amp;lt;math&amp;gt;\mathbf{Var}\left[Y_j\right]\le\frac{1}{(z+1)^2}&amp;lt;/math&amp;gt;, and consequently &amp;lt;math&amp;gt;\mathbf{Var}\left[\overline{Y}\right]\le\frac{1}{k(z+1)^2}&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
{{Proof|&lt;br /&gt;
As in the case of single hash function, by symmetry it holds that &amp;lt;math&amp;gt;\mathbb{E}[Y_j]=\frac{1}{z+1}&amp;lt;/math&amp;gt; for every &amp;lt;math&amp;gt;j=1,2,\ldots,k&amp;lt;/math&amp;gt;. Therefore,&lt;br /&gt;
:&amp;lt;math&amp;gt;\mathbb{E}\left[\overline{Y}\right]=\frac{1}{k}\sum_{j=1}^k\mathbb{E}[Y_j]=\frac{1}{z+1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
Recall that each &amp;lt;math&amp;gt;Y_j&amp;lt;/math&amp;gt; is the minimum of &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; random hash values uniformly and independently distributed over &amp;lt;math&amp;gt;[0,1]&amp;lt;/math&amp;gt;. By geometry probability, it holds that for any &amp;lt;math&amp;gt;y\in[0,1]&amp;lt;/math&amp;gt;,&lt;br /&gt;
:&amp;lt;math&amp;gt;\Pr[Y_j&amp;gt;y]=(1-y)^z&amp;lt;/math&amp;gt;,&lt;br /&gt;
which means &amp;lt;math&amp;gt;\Pr[Y_j\le y]=1-(1-y)^z&amp;lt;/math&amp;gt;. Taking the derivative with respect to &amp;lt;math&amp;gt;y&amp;lt;/math&amp;gt;, we obtain the probability density function of random variable &amp;lt;math&amp;gt;Y_j&amp;lt;/math&amp;gt;, which is &amp;lt;math&amp;gt;z(1-y)^{z-1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We then compute the second moment.&lt;br /&gt;
:&amp;lt;math&amp;gt;\mathbb{E}[Y_j^2]=\int^{1}_0y^2z(1-y)^{z-1}\,\mathrm{d}y=\frac{2}{(z+1)(z+2)}&amp;lt;/math&amp;gt;.&lt;br /&gt;
The variance is bounded as&lt;br /&gt;
:&amp;lt;math&amp;gt;\mathbf{Var}\left[Y_j\right]=\mathbb{E}\left[Y_j^2\right]-\mathbb{E}\left[Y_j\right]^2=\frac{2}{(z+1)(z+2)}-\frac{1}{(z+1)^2}\le\frac{1}{(z+1)^2}&amp;lt;/math&amp;gt;.&lt;br /&gt;
Due to the (pairwise) independence between &amp;lt;math&amp;gt;Y_j&amp;lt;/math&amp;gt;&#039;s,&lt;br /&gt;
::&amp;lt;math&amp;gt;\mathbf{Var}\left[\overline{Y}\right]=\mathbf{Var}\left[\frac{1}{k}\sum_{j=1}^kY_j\right]=\frac{1}{k^2}\sum_{j=1}^k\mathbf{Var}\left[Y_j\right]\le \frac{1}{k(z+1)^2}&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
We resume to prove the inequality &amp;lt;math&amp;gt;({\color{red}*})&amp;lt;/math&amp;gt;. By [[高级算法_(Fall 2023)/Basic_deviation_inequalities#Chebyshev.27s_inequality|Chebyshev&#039;s inequality]], it holds that &lt;br /&gt;
:&amp;lt;math&amp;gt;\Pr\left[\,\left|\overline{Y}-\mathbb{E}\left[\overline{Y}\right]\right|&amp;gt; \frac{\epsilon/2}{z+1}\,\right]&lt;br /&gt;
\le\frac{4}{\epsilon^2}(z+1)^2\mathbf{Var}\left[\overline{Y}\right]&lt;br /&gt;
\le\frac{4}{\epsilon^2k}&amp;lt;/math&amp;gt;.&lt;br /&gt;
When &amp;lt;math&amp;gt;k\ge\left\lceil\frac{4}{\epsilon^2\delta}\right\rceil&amp;lt;/math&amp;gt;, this probability is at most &amp;lt;math&amp;gt;\delta&amp;lt;/math&amp;gt;. The inequality &amp;lt;math&amp;gt;({\color{red}*})&amp;lt;/math&amp;gt; is proved. As we discussed above, this proves the above main theorem &amp;lt;math&amp;gt;\min&amp;lt;/math&amp;gt;-sketch algorithm improved by the mean trick.&lt;br /&gt;
&lt;br /&gt;
= Frequency Estimation=&lt;br /&gt;
Suppose that &amp;lt;math&amp;gt;U&amp;lt;/math&amp;gt; is the data universe. The &#039;&#039;&#039;frequency estimation&#039;&#039;&#039; problem is defined as follows.&lt;br /&gt;
*&#039;&#039;&#039;Data:&#039;&#039;&#039; a sequence of (not necessarily distinct) elements &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_n\in U&amp;lt;/math&amp;gt;;&lt;br /&gt;
*&#039;&#039;&#039;Query:&#039;&#039;&#039; an element &amp;lt;math&amp;gt;x\in U&amp;lt;/math&amp;gt;;&lt;br /&gt;
*&#039;&#039;&#039;Output:&#039;&#039;&#039; an estimation &amp;lt;math&amp;gt;\hat{f}_x&amp;lt;/math&amp;gt; of the frequency &amp;lt;math&amp;gt;f_x\triangleq|\{i\mid x_i=x\}|&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; in input data.&lt;br /&gt;
&lt;br /&gt;
We still want to give an algorithm in the data stream model: the algorithm scan the input sequence &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_n&amp;lt;/math&amp;gt; to construct a succinct data structure, such that upon each query of &amp;lt;math&amp;gt;x\in U&amp;lt;/math&amp;gt;, the algorithm returns an estimation of the frequency &amp;lt;math&amp;gt;f_x&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Clearly this problem can always be solved by storing all appeared distinct elements along with their frequencies. However, the space cost of this straightforward solution is rather high. Instead, we want to use a lossy representation (a &#039;&#039;sketch&#039;&#039;) of input data which uses significantly less space but can still answer queries with tolarable accuracy. &lt;br /&gt;
&lt;br /&gt;
Formally, upon each query of &amp;lt;math&amp;gt;x\in U&amp;lt;/math&amp;gt;, the algorithm should return an answer &amp;lt;math&amp;gt;\hat{f}_x&amp;lt;/math&amp;gt; satisfying:&lt;br /&gt;
:&amp;lt;math&amp;gt;\Pr\left[\,\left|\hat{f}_x-f_x\right|\le \epsilon n\,\right]\ge 1-\delta&amp;lt;/math&amp;gt;.&lt;br /&gt;
Note that this notion of approximation is with bounded &#039;&#039;additive&#039;&#039; error which is weaker than the notion of &amp;lt;math&amp;gt;(\epsilon,\delta)&amp;lt;/math&amp;gt;-estimator, whose error bound is &#039;&#039;multiplicative&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
With such weak accuracy guarantee, its is possible to give a succinct data structure whose size is determined only by the error bounds &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\delta&amp;lt;/math&amp;gt; but independent of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;, because only the frequencies of those &#039;&#039;&#039;heavy hitters&#039;&#039;&#039; (elements &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; with high frequencies &amp;lt;math&amp;gt;f_x&amp;gt;\epsilon n&amp;lt;/math&amp;gt;) need to be memorized, and there are at most &amp;lt;math&amp;gt;1/\epsilon&amp;lt;/math&amp;gt; many such heavy hitters.&lt;br /&gt;
&lt;br /&gt;
== Count-min sketch==&lt;br /&gt;
The [https://en.wikipedia.org/wiki/Count–min_sketch count-min sketch] given by Cormode and Muthukrishnan is an elegant data structure for frequency estimation.&lt;br /&gt;
&lt;br /&gt;
The data structure is a two-dimensional &amp;lt;math&amp;gt;k\times m&amp;lt;/math&amp;gt; integer array, where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; are two parameters to be determined by the error bounds &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\delta&amp;lt;/math&amp;gt;. We still adopt the Uniform Hash Assumption to assume that we have access to &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; mutually independent uniform random hash functions &amp;lt;math&amp;gt;h_1,h_2,\ldots,h_k: U\to[m]&amp;lt;/math&amp;gt;.&lt;br /&gt;
{{Theorem|&#039;&#039;Count-min sketch&#039;&#039; (Cormode and Muthukrishnan 2003)|&lt;br /&gt;
:Suppose &amp;lt;math&amp;gt;h_1,h_2,\ldots,h_k: U\to[m]&amp;lt;/math&amp;gt; are uniform and independent random hash functions.&lt;br /&gt;
-----&lt;br /&gt;
:&#039;&#039;&#039;Data structure construction:&#039;&#039;&#039; Given a sequence &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_n\in U&amp;lt;/math&amp;gt;, the data structure is a two-dimensional &amp;lt;math&amp;gt;k\times m&amp;lt;/math&amp;gt; integer array &amp;lt;math&amp;gt;CMS[k][m]&amp;lt;/math&amp;gt; constructed as&lt;br /&gt;
:*initialize all entries of &amp;lt;math&amp;gt;CMS[k][m]&amp;lt;/math&amp;gt; to 0;&lt;br /&gt;
:*for &amp;lt;math&amp;gt;i=1,2,\ldots,n&amp;lt;/math&amp;gt;, upon receiving &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt;:&lt;br /&gt;
::: for every &amp;lt;math&amp;gt;1\le j\le k&amp;lt;/math&amp;gt;, evaluate &amp;lt;math&amp;gt;h_j(x_i)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;CMS[j][h_j(x_i)]++&amp;lt;/math&amp;gt;.&lt;br /&gt;
----&lt;br /&gt;
:&#039;&#039;&#039;Query resolution:&#039;&#039;&#039; Upon each query of an arbitrary &amp;lt;math&amp;gt;x\in U&amp;lt;/math&amp;gt;,&lt;br /&gt;
:* return &amp;lt;math&amp;gt;\hat{f}_x=\min_{1\le j\le k}CMS[j][h_j(x)]&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
It is easy to see that the space cost of count-min sketch is &amp;lt;math&amp;gt;O(km)&amp;lt;/math&amp;gt; memory words, or &amp;lt;math&amp;gt;O(km\log n)&amp;lt;/math&amp;gt; bits. Each query is answered within time cost &amp;lt;math&amp;gt;O(k)&amp;lt;/math&amp;gt;, assuming that an evaluation of hash function can be done in unit or constant time. We then analyze the error bounds.&lt;br /&gt;
&lt;br /&gt;
First, it is easy to observe that for any query &amp;lt;math&amp;gt;x\in U&amp;lt;/math&amp;gt; and every hash function &amp;lt;math&amp;gt;1\le j\le k&amp;lt;/math&amp;gt;, it always holds for the corresponding entry in the count-min sketch&lt;br /&gt;
:&amp;lt;math&amp;gt;CMS[j][h_j(x)]\ge f_x&amp;lt;/math&amp;gt;,&lt;br /&gt;
because the appearances of element &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; in the input sequence contribute at least &amp;lt;math&amp;gt;f_x&amp;lt;/math&amp;gt; to the value of &amp;lt;math&amp;gt;CMS[j][h_j(x)]&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Therefore, for any query &amp;lt;math&amp;gt;x\in U&amp;lt;/math&amp;gt; it always holds for the answer &amp;lt;math&amp;gt;\hat{f}_x=\min_{1\le j\le k}CMS[j][h_j(x)]\ge f_x&amp;lt;/math&amp;gt;, which means&lt;br /&gt;
:&amp;lt;math&amp;gt;\Pr\left[\,\left|\hat{f}_x- f_x\right|\ge\epsilon n\,\right]=\Pr\left[\,\hat{f}_x- f_x\ge\epsilon n\,\right]=\prod_{j=1}^k\Pr[\,CMS[j][h_j(x)]-f_x\ge\epsilon n\,],\quad\qquad({\color{red}\diamondsuit})&amp;lt;/math&amp;gt;&lt;br /&gt;
where the second equation is due to the mutual independence of random hash functions &amp;lt;math&amp;gt;h_1,h_2,\ldots,h_k&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
It remains to upper bound the probability &amp;lt;math&amp;gt;\Pr[\,CMS[j][h_j(x)]-f_x\ge\epsilon n\,]&amp;lt;/math&amp;gt;, which can be done by calculating the expectation of &amp;lt;math&amp;gt;CMS[j][h_j(x)]&amp;lt;/math&amp;gt;.&lt;br /&gt;
{{Theorem|Proposition|&lt;br /&gt;
:For any &amp;lt;math&amp;gt;x\in U&amp;lt;/math&amp;gt; and every &amp;lt;math&amp;gt;1\le j\le k&amp;lt;/math&amp;gt;, it holds that &amp;lt;math&amp;gt;\mathbb{E}\left[CMS[j][h_j(x)]\right]\le f_x+\frac{n}{m}&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
{{Proof|&lt;br /&gt;
The value of &amp;lt;math&amp;gt;CMS[j][h_j(x)]&amp;lt;/math&amp;gt; is constituted by the frequency &amp;lt;math&amp;gt;f_x&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and the frequencies &amp;lt;math&amp;gt;f_y&amp;lt;/math&amp;gt; of all other elements &amp;lt;math&amp;gt;y\neq x&amp;lt;/math&amp;gt; among &amp;lt;math&amp;gt;x_1,x_2,\ldots,x_n&amp;lt;/math&amp;gt;, thus&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{align}&lt;br /&gt;
CMS[j][h_j(x)]&lt;br /&gt;
&amp;amp;=f_x+\sum_{\scriptstyle y\in\{x_1,\ldots,x_n\}\setminus\{x\}\atop\scriptstyle h_j(y)=h_j(x)} f_y\\&lt;br /&gt;
&amp;amp;=f_x+\sum_{y\in\{x_1,\ldots,x_n\}\setminus\{x\}} f_y \cdot I[h_j(y)=h_j(x)]&lt;br /&gt;
\end{align}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math&amp;gt;I[h_j(y)=h_j(x)]&amp;lt;/math&amp;gt; denotes the Boolean random variable that indicates the occurrence of event &amp;lt;math&amp;gt;h_j(y)=h_j(x)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
By linearity of expectation,&lt;br /&gt;
:&amp;lt;math&amp;gt;\mathbb{E}[CMS[j][h_j(x)]]=f_x+\sum_{y\in\{x_1,x_2,\ldots,x_n\}\setminus\{x\}} f_y \cdot \Pr[h_j(y)=h_j(x)]&amp;lt;/math&amp;gt;.&lt;br /&gt;
Due to Uniform Hash Assumption (UHA), &amp;lt;math&amp;gt;h_j: U\to[m]&amp;lt;/math&amp;gt; is a uniform random function. For any &amp;lt;math&amp;gt;y\neq x&amp;lt;/math&amp;gt;, the probability of hash collision is&lt;br /&gt;
:&amp;lt;math&amp;gt;\Pr[h_j(y)=h_j(x)]=\frac{1}{m}&amp;lt;/math&amp;gt;.&lt;br /&gt;
Therefore,&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{align}&lt;br /&gt;
\mathbb{E}[CMS[j][h_j(x)]]&lt;br /&gt;
&amp;amp;=f_x+\frac{1}{m}\sum_{y\in\{x_1,\ldots,x_n\}\setminus\{x\}} f_y \\&lt;br /&gt;
&amp;amp;\le f_x+\frac{1}{m}\sum_{y\in\{x_1,\ldots,x_n\}} f_y\\&lt;br /&gt;
&amp;amp;=f_x+\frac{n}{m},&lt;br /&gt;
\end{align}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where the last equation is due to the obvious identity &amp;lt;math&amp;gt;\sum_{y\in\{x_1,\ldots,x_n\}}f_y=n&amp;lt;/math&amp;gt;.&lt;br /&gt;
}}&lt;br /&gt;
The above proposition shows that for any &amp;lt;math&amp;gt;x\in U&amp;lt;/math&amp;gt; and every &amp;lt;math&amp;gt;1\le j\le k&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\mathbb{E}\left[CMS[j][h_j(x)]-f_x\right]\le \frac{n}{m}&amp;lt;/math&amp;gt;.&lt;br /&gt;
Recall that &amp;lt;math&amp;gt;CMS[j][h_j(x)]\ge f_x&amp;lt;/math&amp;gt; always holds, thus &amp;lt;math&amp;gt;CMS[j][h_j(x)]-f_x&amp;lt;/math&amp;gt; is a positive random variable. By Markov&#039;s inequality, we have&lt;br /&gt;
:&amp;lt;math&amp;gt;\Pr[\,CMS[j][h_j(x)]-f_x\ge\epsilon n\,]\le \frac{1}{\epsilon m}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Combining with above equation &amp;lt;math&amp;gt;({\color{red}\diamondsuit})&amp;lt;/math&amp;gt;, we have&lt;br /&gt;
:&amp;lt;math&amp;gt;\Pr\left[\,\left|\hat{f}_x- f_x\right|\ge\epsilon n\,\right]=(\Pr[\,CMS[j][h_j(x)]-f_x\ge\epsilon n\,])^k\le \frac{1}{(\epsilon m)^k}&amp;lt;/math&amp;gt;.&lt;br /&gt;
By setting &amp;lt;math&amp;gt;m=\left\lceil\frac{\mathrm{e}}{\epsilon}\right\rceil&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;k=\left\lceil\ln\frac{1}{\delta}\right\rceil&amp;lt;/math&amp;gt;, the above error probability is bounded as &amp;lt;math&amp;gt;\frac{1}{(\epsilon m)^k}\le\delta&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
For any positive &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\delta&amp;lt;/math&amp;gt;, the count-min sketch gives a data structure of size &amp;lt;math&amp;gt;O(km)=O\left(\frac{1}{\epsilon}\log\frac{1}{\delta}\right)&amp;lt;/math&amp;gt; (in memory words) and answering each query &amp;lt;math&amp;gt;x\in U&amp;lt;/math&amp;gt; in time &amp;lt;math&amp;gt;O(k)=O\left(\frac{1}{\epsilon}\right)&amp;lt;/math&amp;gt; with the following accuracy guarantee:&lt;br /&gt;
:&amp;lt;math&amp;gt;\Pr\left[\,\left|\hat{f}_x- f_x\right|\le\epsilon n\,\right]\ge 1-\delta&amp;lt;/math&amp;gt;.&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=%E9%AB%98%E7%BA%A7%E7%AE%97%E6%B3%95_(Fall_2024)&amp;diff=12634</id>
		<title>高级算法 (Fall 2024)</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=%E9%AB%98%E7%BA%A7%E7%AE%97%E6%B3%95_(Fall_2024)&amp;diff=12634"/>
		<updated>2024-10-02T02:57:07Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: /* Assignments */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox&lt;br /&gt;
|name         = Infobox&lt;br /&gt;
|bodystyle    = &lt;br /&gt;
|title        = &amp;lt;font size=3&amp;gt;高级算法 &lt;br /&gt;
&amp;lt;br&amp;gt;Advanced Algorithms&amp;lt;/font&amp;gt;&lt;br /&gt;
|titlestyle   = &lt;br /&gt;
&lt;br /&gt;
|image        = &lt;br /&gt;
|imagestyle   = &lt;br /&gt;
|caption      = &lt;br /&gt;
|captionstyle = &lt;br /&gt;
|headerstyle  = background:#ccf;&lt;br /&gt;
|labelstyle   = background:#ddf;&lt;br /&gt;
|datastyle    = &lt;br /&gt;
&lt;br /&gt;
|header1 =Instructor&lt;br /&gt;
|label1  = &lt;br /&gt;
|data1   = &lt;br /&gt;
|header2 = &lt;br /&gt;
|label2  = &lt;br /&gt;
|data2   = &#039;&#039;&#039;尹一通&#039;&#039;&#039;&lt;br /&gt;
|header3 = &lt;br /&gt;
|label3  = Email&lt;br /&gt;
|data3   = yinyt@nju.edu.cn &lt;br /&gt;
|header4 =&lt;br /&gt;
|label4= office&lt;br /&gt;
|data4= 计算机系 804&lt;br /&gt;
|header5 = &lt;br /&gt;
|label5  = &lt;br /&gt;
|data5   = &#039;&#039;&#039;栗师&#039;&#039;&#039;&lt;br /&gt;
|header6 = &lt;br /&gt;
|label6  = Email&lt;br /&gt;
|data6   = shili@nju.edu.cn &lt;br /&gt;
|header7 =&lt;br /&gt;
|label7= office&lt;br /&gt;
|data7= 计算机系 605&lt;br /&gt;
|header8 = &lt;br /&gt;
|label8  = &lt;br /&gt;
|data8   = &#039;&#039;&#039;刘景铖&#039;&#039;&#039;&lt;br /&gt;
|header9 = &lt;br /&gt;
|label9  = Email&lt;br /&gt;
|data9   = liu@nju.edu.cn &lt;br /&gt;
|header10 =&lt;br /&gt;
|label10= office&lt;br /&gt;
|data10= 计算机系 516&lt;br /&gt;
|header11 = Class&lt;br /&gt;
|label11  = &lt;br /&gt;
|data11   = &lt;br /&gt;
|header12 =&lt;br /&gt;
|label12  = Class meetings&lt;br /&gt;
|data12   = Monday (单), 4pm-6pm &amp;lt;br&amp;gt; Thursday, 2pm-4pm &amp;lt;br&amp;gt;仙Ⅰ-206&lt;br /&gt;
|header13 =&lt;br /&gt;
|label13  = Place&lt;br /&gt;
|data13   = &lt;br /&gt;
|header14 =&lt;br /&gt;
|label14  = Office hours&lt;br /&gt;
|data14   = Monday, 2pm-4pm, &amp;lt;br&amp;gt;计算机系 804&amp;lt;br&amp;gt;&lt;br /&gt;
|header15 = Textbooks&lt;br /&gt;
|label15  = &lt;br /&gt;
|data15   = &lt;br /&gt;
|header16 =&lt;br /&gt;
|label16  = &lt;br /&gt;
|data16   = [[File:MR-randomized-algorithms.png|border|100px]]&lt;br /&gt;
|header17 =&lt;br /&gt;
|label17  = &lt;br /&gt;
|data17   = Motwani and Raghavan. &amp;lt;br&amp;gt;&#039;&#039;Randomized Algorithms&#039;&#039;.&amp;lt;br&amp;gt; Cambridge Univ Press, 1995.&lt;br /&gt;
|header18 =&lt;br /&gt;
|label18  = &lt;br /&gt;
|data18   = [[File:Approximation_Algorithms.jpg|border|100px]]&lt;br /&gt;
|header19 =&lt;br /&gt;
|label19  = &lt;br /&gt;
|data19   =  Vazirani. &amp;lt;br&amp;gt;&#039;&#039;Approximation Algorithms&#039;&#039;. &amp;lt;br&amp;gt; Springer-Verlag, 2001.&lt;br /&gt;
|belowstyle = background:#ddf;&lt;br /&gt;
|below = &lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
This is the webpage for the &#039;&#039;Advanced Algorithms&#039;&#039; class of fall 2024. Students who take this class should check this page periodically for content updates and new announcements. &lt;br /&gt;
&lt;br /&gt;
= Announcement =&lt;br /&gt;
&lt;br /&gt;
* TBA&lt;br /&gt;
&lt;br /&gt;
= Course info =&lt;br /&gt;
* &#039;&#039;&#039;Instructor &#039;&#039;&#039;: &lt;br /&gt;
:* [http://tcs.nju.edu.cn/yinyt/ 尹一通]：[mailto:yinyt@nju.edu.cn &amp;lt;yinyt@nju.edu.cn&amp;gt;]，计算机系 804 &lt;br /&gt;
:*[https://tcs.nju.edu.cn/shili/ 栗师]：[mailto:shili@nju.edu.cn &amp;lt;shili@nju.edu.cn&amp;gt;]，计算机系 605&lt;br /&gt;
:* [https://liuexp.github.io 刘景铖]：[mailto:liu@nju.edu.cn &amp;lt;liu@nju.edu.cn&amp;gt;]，计算机系 516 &lt;br /&gt;
* &#039;&#039;&#039;Teaching Assistant&#039;&#039;&#039;: &lt;br /&gt;
** 于逸潇：yixiaoyu@smail.nju.edu.cn&lt;br /&gt;
** 张弈垚：zhangyiyao@smail.nju.edu.cn&lt;br /&gt;
* &#039;&#039;&#039;Class meeting&#039;&#039;&#039;: &lt;br /&gt;
** Monday (单), 4pm-6pm, 仙Ⅰ-206&lt;br /&gt;
** Thursday, 2pm-4pm, 仙Ⅰ-206&lt;br /&gt;
* &#039;&#039;&#039;Office hour&#039;&#039;&#039;: Monday, 2pm-4pm, 计算机系 804&lt;br /&gt;
* &#039;&#039;&#039;QQ群&#039;&#039;&#039;: 757436140&lt;br /&gt;
&lt;br /&gt;
= Syllabus =&lt;br /&gt;
随着计算机算法理论的不断发展，现代计算机算法的设计与分析大量地使用非初等的数学工具以及非传统的算法思想。“高级算法”这门课程就是面向计算机算法的这一发展趋势而设立的。课程将针对传统算法课程未系统涉及、却在计算机科学各领域的科研和实践中扮演重要角色的高等算法设计思想和算法分析工具进行系统讲授。&lt;br /&gt;
&lt;br /&gt;
=== 先修课程 Prerequisites ===&lt;br /&gt;
* 必须：离散数学，概率论，线性代数。&lt;br /&gt;
* 推荐：算法设计与分析。&lt;br /&gt;
&lt;br /&gt;
=== Course materials ===&lt;br /&gt;
* [[高级算法 (Fall 2024) / Course materials|&amp;lt;font size=3&amp;gt;教材和参考书&amp;lt;/font&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
=== 成绩 Grades ===&lt;br /&gt;
* 课程成绩：本课程将会有若干次作业和一次期末考试。最终成绩将由平时作业成绩和期末考试成绩综合得出。&lt;br /&gt;
* 迟交：如果有特殊的理由，无法按时完成作业，请提前联系授课老师，给出正当理由。否则迟交的作业将不被接受。&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font color=red&amp;gt; 学术诚信 Academic Integrity &amp;lt;/font&amp;gt;===&lt;br /&gt;
学术诚信是所有从事学术活动的学生和学者最基本的职业道德底线，本课程将不遗余力的维护学术诚信规范，违反这一底线的行为将不会被容忍。&lt;br /&gt;
&lt;br /&gt;
作业完成的原则：署你名字的工作必须是你个人的贡献。在完成作业的过程中，允许讨论，前提是讨论的所有参与者均处于同等完成度。但关键想法的执行、以及作业文本的写作必须独立完成，并在作业中致谢（acknowledge）所有参与讨论的人。不允许其他任何形式的合作——尤其是与已经完成作业的同学“讨论”。&lt;br /&gt;
&lt;br /&gt;
本课程将对剽窃行为采取零容忍的态度。在完成作业过程中，对他人工作（出版物、互联网资料、其他人的作业等）直接的文本抄袭和对关键思想、关键元素的抄袭，按照 [http://www.acm.org/publications/policies/plagiarism_policy ACM Policy on Plagiarism]的解释，都将视为剽窃。剽窃者成绩将被取消。如果发现互相抄袭行为，&amp;lt;font color=red&amp;gt; 抄袭和被抄袭双方的成绩都将被取消&amp;lt;/font&amp;gt;。因此请主动防止自己的作业被他人抄袭。&lt;br /&gt;
&lt;br /&gt;
学术诚信影响学生个人的品行，也关乎整个教育系统的正常运转。为了一点分数而做出学术不端的行为，不仅使自己沦为一个欺骗者，也使他人的诚实努力失去意义。让我们一起努力维护一个诚信的环境。&lt;br /&gt;
&lt;br /&gt;
= Assignments =&lt;br /&gt;
Late policy: In general, we will accomodate late submission requests ONLY IF you made such requests ahead of time. &lt;br /&gt;
&lt;br /&gt;
*[[高级算法 (Fall 2024)/Problem Set 1|Problem Set 1]]  请在 2024/10/14 上课之前(16:00 UTC+8)提交到 [mailto:njuadvalg24@163.com njuadvalg24@163.com] (文件名为&#039;&amp;lt;font color=red &amp;gt;学号_姓名_A1.pdf&amp;lt;/font&amp;gt;&#039;).&lt;br /&gt;
&lt;br /&gt;
= Lecture Notes =&lt;br /&gt;
# [[高级算法 (Fall 2024)/Min Cut, Max Cut, and Spectral Cut|Min Cut, Max Cut, and Spectral Cut]] ([http://tcs.nju.edu.cn/slides/aa2024/Cut.pdf slides])&lt;br /&gt;
#*  [[高级算法 (Fall 2024)/Probability Basics|Probability basics]]&lt;br /&gt;
#  [[高级算法 (Fall 2024)/Fingerprinting| Fingerprinting]] ([http://tcs.nju.edu.cn/slides/aa2024/Fingerprinting.pdf slides]) &lt;br /&gt;
#*  [[高级算法 (Fall 2024)/Finite Field Basics|Finite field basics]]&lt;br /&gt;
#  [[高级算法 (Fall 2024)/Hashing and Sketching|Hashing and Sketching]] ([http://tcs.nju.edu.cn/slides/aa2024/Hashing.pdf slides])   &lt;br /&gt;
#*  [[高级算法 (Fall 2024)/Limited independence|Limited independence]]&lt;br /&gt;
#*  [[高级算法 (Fall 2024)/Basic deviation inequalities|Basic deviation inequalities]]&lt;br /&gt;
# [[高级算法 (Fall 2024)/Concentration of measure|Concentration of measure]] ([http://tcs.nju.edu.cn/slides/aa2024/Concentration.pdf slides])&lt;br /&gt;
#*  [[高级算法 (Fall 2024)/Conditional expectations|Conditional expectations]]&lt;br /&gt;
# [[高级算法 (Fall 2024)/Dimension Reduction|Dimension Reduction]] ([http://tcs.nju.edu.cn/slides/aa2023/NNS.pdf slides]) &lt;br /&gt;
#* [https://www.cs.princeton.edu/~hy2/teaching/fall22-cos521/notes/JL.pdf Professor Huacheng Yu&#039;s note on Johnson-Lindenstrauss Theorem]&lt;br /&gt;
#* [http://people.csail.mit.edu/gregory/annbook/introduction.pdf An introduction of LSH]&lt;br /&gt;
&lt;br /&gt;
= Related Online Courses=&lt;br /&gt;
* [https://www.cs.cmu.edu/~15850/ Advanced Algorithms] by Anupam Gupta at CMU.&lt;br /&gt;
* [http://people.csail.mit.edu/moitra/854.html Advanced Algorithms] by Ankur Moitra at MIT.&lt;br /&gt;
* [http://courses.csail.mit.edu/6.854/current/ Advanced Algorithms] by David Karger and Aleksander Mądry at MIT.&lt;br /&gt;
* [http://web.stanford.edu/class/cs168/index.html The Modern Algorithmic Toolbox] by Tim Roughgarden and Gregory Valiant at Stanford.&lt;br /&gt;
* [https://www.cs.princeton.edu/courses/archive/fall18/cos521/ Advanced Algorithm Design] by Pravesh Kothari and Christopher Musco at Princeton.&lt;br /&gt;
* [http://www.cs.cmu.edu/afs/cs.cmu.edu/academic/class/15859-f11/www/ Linear and Semidefinite Programming (Advanced Algorithms)] by Anupam Gupta and Ryan O&#039;Donnell at CMU.&lt;br /&gt;
* [https://www.cs.cmu.edu/~odonnell/papers/cs-theory-toolkit-lecture-notes.pdf CS Theory Toolkit] by Ryan O&#039;Donnell at CMU.&lt;br /&gt;
* [https://cs.uwaterloo.ca/~lapchi/cs860/index.html Eigenvalues and Polynomials] by Lap Chi Lau at University of Waterloo.&lt;br /&gt;
* The [https://www.cs.cornell.edu/jeh/book.pdf &amp;quot;Foundations of Data Science&amp;quot; book] by Avrim Blum, John Hopcroft, and Ravindran Kannan.&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=%E9%AB%98%E7%BA%A7%E7%AE%97%E6%B3%95_(Fall_2024)&amp;diff=12616</id>
		<title>高级算法 (Fall 2024)</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=%E9%AB%98%E7%BA%A7%E7%AE%97%E6%B3%95_(Fall_2024)&amp;diff=12616"/>
		<updated>2024-09-29T13:28:31Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: /* Assignments */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox&lt;br /&gt;
|name         = Infobox&lt;br /&gt;
|bodystyle    = &lt;br /&gt;
|title        = &amp;lt;font size=3&amp;gt;高级算法 &lt;br /&gt;
&amp;lt;br&amp;gt;Advanced Algorithms&amp;lt;/font&amp;gt;&lt;br /&gt;
|titlestyle   = &lt;br /&gt;
&lt;br /&gt;
|image        = &lt;br /&gt;
|imagestyle   = &lt;br /&gt;
|caption      = &lt;br /&gt;
|captionstyle = &lt;br /&gt;
|headerstyle  = background:#ccf;&lt;br /&gt;
|labelstyle   = background:#ddf;&lt;br /&gt;
|datastyle    = &lt;br /&gt;
&lt;br /&gt;
|header1 =Instructor&lt;br /&gt;
|label1  = &lt;br /&gt;
|data1   = &lt;br /&gt;
|header2 = &lt;br /&gt;
|label2  = &lt;br /&gt;
|data2   = &#039;&#039;&#039;尹一通&#039;&#039;&#039;&lt;br /&gt;
|header3 = &lt;br /&gt;
|label3  = Email&lt;br /&gt;
|data3   = yinyt@nju.edu.cn &lt;br /&gt;
|header4 =&lt;br /&gt;
|label4= office&lt;br /&gt;
|data4= 计算机系 804&lt;br /&gt;
|header5 = &lt;br /&gt;
|label5  = &lt;br /&gt;
|data5   = &#039;&#039;&#039;栗师&#039;&#039;&#039;&lt;br /&gt;
|header6 = &lt;br /&gt;
|label6  = Email&lt;br /&gt;
|data6   = shili@nju.edu.cn &lt;br /&gt;
|header7 =&lt;br /&gt;
|label7= office&lt;br /&gt;
|data7= 计算机系 605&lt;br /&gt;
|header8 = &lt;br /&gt;
|label8  = &lt;br /&gt;
|data8   = &#039;&#039;&#039;刘景铖&#039;&#039;&#039;&lt;br /&gt;
|header9 = &lt;br /&gt;
|label9  = Email&lt;br /&gt;
|data9   = liu@nju.edu.cn &lt;br /&gt;
|header10 =&lt;br /&gt;
|label10= office&lt;br /&gt;
|data10= 计算机系 516&lt;br /&gt;
|header11 = Class&lt;br /&gt;
|label11  = &lt;br /&gt;
|data11   = &lt;br /&gt;
|header12 =&lt;br /&gt;
|label12  = Class meetings&lt;br /&gt;
|data12   = Monday (单), 4pm-6pm &amp;lt;br&amp;gt; Thursday, 2pm-4pm &amp;lt;br&amp;gt;仙Ⅰ-206&lt;br /&gt;
|header13 =&lt;br /&gt;
|label13  = Place&lt;br /&gt;
|data13   = &lt;br /&gt;
|header14 =&lt;br /&gt;
|label14  = Office hours&lt;br /&gt;
|data14   = Monday, 2pm-4pm, &amp;lt;br&amp;gt;计算机系 804&amp;lt;br&amp;gt;&lt;br /&gt;
|header15 = Textbooks&lt;br /&gt;
|label15  = &lt;br /&gt;
|data15   = &lt;br /&gt;
|header16 =&lt;br /&gt;
|label16  = &lt;br /&gt;
|data16   = [[File:MR-randomized-algorithms.png|border|100px]]&lt;br /&gt;
|header17 =&lt;br /&gt;
|label17  = &lt;br /&gt;
|data17   = Motwani and Raghavan. &amp;lt;br&amp;gt;&#039;&#039;Randomized Algorithms&#039;&#039;.&amp;lt;br&amp;gt; Cambridge Univ Press, 1995.&lt;br /&gt;
|header18 =&lt;br /&gt;
|label18  = &lt;br /&gt;
|data18   = [[File:Approximation_Algorithms.jpg|border|100px]]&lt;br /&gt;
|header19 =&lt;br /&gt;
|label19  = &lt;br /&gt;
|data19   =  Vazirani. &amp;lt;br&amp;gt;&#039;&#039;Approximation Algorithms&#039;&#039;. &amp;lt;br&amp;gt; Springer-Verlag, 2001.&lt;br /&gt;
|belowstyle = background:#ddf;&lt;br /&gt;
|below = &lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
This is the webpage for the &#039;&#039;Advanced Algorithms&#039;&#039; class of fall 2024. Students who take this class should check this page periodically for content updates and new announcements. &lt;br /&gt;
&lt;br /&gt;
= Announcement =&lt;br /&gt;
&lt;br /&gt;
* TBA&lt;br /&gt;
&lt;br /&gt;
= Course info =&lt;br /&gt;
* &#039;&#039;&#039;Instructor &#039;&#039;&#039;: &lt;br /&gt;
:* [http://tcs.nju.edu.cn/yinyt/ 尹一通]：[mailto:yinyt@nju.edu.cn &amp;lt;yinyt@nju.edu.cn&amp;gt;]，计算机系 804 &lt;br /&gt;
:*[https://tcs.nju.edu.cn/shili/ 栗师]：[mailto:shili@nju.edu.cn &amp;lt;shili@nju.edu.cn&amp;gt;]，计算机系 605&lt;br /&gt;
:* [https://liuexp.github.io 刘景铖]：[mailto:liu@nju.edu.cn &amp;lt;liu@nju.edu.cn&amp;gt;]，计算机系 516 &lt;br /&gt;
* &#039;&#039;&#039;Teaching Assistant&#039;&#039;&#039;: &lt;br /&gt;
** 于逸潇：yixiaoyu@smail.nju.edu.cn&lt;br /&gt;
** 张弈垚：zhangyiyao@smail.nju.edu.cn&lt;br /&gt;
* &#039;&#039;&#039;Class meeting&#039;&#039;&#039;: &lt;br /&gt;
** Monday (单), 4pm-6pm, 仙Ⅰ-206&lt;br /&gt;
** Thursday, 2pm-4pm, 仙Ⅰ-206&lt;br /&gt;
* &#039;&#039;&#039;Office hour&#039;&#039;&#039;: Monday, 2pm-4pm, 计算机系 804&lt;br /&gt;
* &#039;&#039;&#039;QQ群&#039;&#039;&#039;: 757436140&lt;br /&gt;
&lt;br /&gt;
= Syllabus =&lt;br /&gt;
随着计算机算法理论的不断发展，现代计算机算法的设计与分析大量地使用非初等的数学工具以及非传统的算法思想。“高级算法”这门课程就是面向计算机算法的这一发展趋势而设立的。课程将针对传统算法课程未系统涉及、却在计算机科学各领域的科研和实践中扮演重要角色的高等算法设计思想和算法分析工具进行系统讲授。&lt;br /&gt;
&lt;br /&gt;
=== 先修课程 Prerequisites ===&lt;br /&gt;
* 必须：离散数学，概率论，线性代数。&lt;br /&gt;
* 推荐：算法设计与分析。&lt;br /&gt;
&lt;br /&gt;
=== Course materials ===&lt;br /&gt;
* [[高级算法 (Fall 2024) / Course materials|&amp;lt;font size=3&amp;gt;教材和参考书&amp;lt;/font&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
=== 成绩 Grades ===&lt;br /&gt;
* 课程成绩：本课程将会有若干次作业和一次期末考试。最终成绩将由平时作业成绩和期末考试成绩综合得出。&lt;br /&gt;
* 迟交：如果有特殊的理由，无法按时完成作业，请提前联系授课老师，给出正当理由。否则迟交的作业将不被接受。&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font color=red&amp;gt; 学术诚信 Academic Integrity &amp;lt;/font&amp;gt;===&lt;br /&gt;
学术诚信是所有从事学术活动的学生和学者最基本的职业道德底线，本课程将不遗余力的维护学术诚信规范，违反这一底线的行为将不会被容忍。&lt;br /&gt;
&lt;br /&gt;
作业完成的原则：署你名字的工作必须是你个人的贡献。在完成作业的过程中，允许讨论，前提是讨论的所有参与者均处于同等完成度。但关键想法的执行、以及作业文本的写作必须独立完成，并在作业中致谢（acknowledge）所有参与讨论的人。不允许其他任何形式的合作——尤其是与已经完成作业的同学“讨论”。&lt;br /&gt;
&lt;br /&gt;
本课程将对剽窃行为采取零容忍的态度。在完成作业过程中，对他人工作（出版物、互联网资料、其他人的作业等）直接的文本抄袭和对关键思想、关键元素的抄袭，按照 [http://www.acm.org/publications/policies/plagiarism_policy ACM Policy on Plagiarism]的解释，都将视为剽窃。剽窃者成绩将被取消。如果发现互相抄袭行为，&amp;lt;font color=red&amp;gt; 抄袭和被抄袭双方的成绩都将被取消&amp;lt;/font&amp;gt;。因此请主动防止自己的作业被他人抄袭。&lt;br /&gt;
&lt;br /&gt;
学术诚信影响学生个人的品行，也关乎整个教育系统的正常运转。为了一点分数而做出学术不端的行为，不仅使自己沦为一个欺骗者，也使他人的诚实努力失去意义。让我们一起努力维护一个诚信的环境。&lt;br /&gt;
&lt;br /&gt;
= Assignments =&lt;br /&gt;
*[[高级算法 (Fall 2024)/Problem Set 1|Problem Set 1]]  请在 2024/10/14 上课之前(16:00 UTC+8)提交到 [mailto:njuadvalg24@163.com njuadvalg24@163.com] (文件名为&#039;&amp;lt;font color=red &amp;gt;学号_姓名_A1.pdf&amp;lt;/font&amp;gt;&#039;).&lt;br /&gt;
&lt;br /&gt;
= Lecture Notes =&lt;br /&gt;
# [[高级算法 (Fall 2024)/Min Cut, Max Cut, and Spectral Cut|Min Cut, Max Cut, and Spectral Cut]] ([http://tcs.nju.edu.cn/slides/aa2024/Cut.pdf slides])&lt;br /&gt;
#*  [[高级算法 (Fall 2024)/Probability Basics|Probability basics]]&lt;br /&gt;
#  [[高级算法 (Fall 2024)/Fingerprinting| Fingerprinting]] ([http://tcs.nju.edu.cn/slides/aa2024/Fingerprinting.pdf slides]) &lt;br /&gt;
#*  [[高级算法 (Fall 2024)/Finite Field Basics|Finite field basics]]&lt;br /&gt;
#  [[高级算法 (Fall 2024)/Hashing and Sketching|Hashing and Sketching]] ([http://tcs.nju.edu.cn/slides/aa2024/Hashing.pdf slides])   &lt;br /&gt;
#*  [[高级算法 (Fall 2024)/Limited independence|Limited independence]]&lt;br /&gt;
#*  [[高级算法 (Fall 2024)/Basic deviation inequalities|Basic deviation inequalities]]&lt;br /&gt;
# [[高级算法 (Fall 2024)/Concentration of measure|Concentration of measure]] ([http://tcs.nju.edu.cn/slides/aa2024/Concentration.pdf slides])&lt;br /&gt;
#*  [[高级算法 (Fall 2024)/Conditional expectations|Conditional expectations]]&lt;br /&gt;
# [[高级算法 (Fall 2024)/Dimension Reduction|Dimension Reduction]] ([http://tcs.nju.edu.cn/slides/aa2023/NNS.pdf slides]) &lt;br /&gt;
#* [https://www.cs.princeton.edu/~hy2/teaching/fall22-cos521/notes/JL.pdf Professor Huacheng Yu&#039;s note on Johnson-Lindenstrauss Theorem]&lt;br /&gt;
#* [http://people.csail.mit.edu/gregory/annbook/introduction.pdf An introduction of LSH]&lt;br /&gt;
&lt;br /&gt;
= Related Online Courses=&lt;br /&gt;
* [https://www.cs.cmu.edu/~15850/ Advanced Algorithms] by Anupam Gupta at CMU.&lt;br /&gt;
* [http://people.csail.mit.edu/moitra/854.html Advanced Algorithms] by Ankur Moitra at MIT.&lt;br /&gt;
* [http://courses.csail.mit.edu/6.854/current/ Advanced Algorithms] by David Karger and Aleksander Mądry at MIT.&lt;br /&gt;
* [http://web.stanford.edu/class/cs168/index.html The Modern Algorithmic Toolbox] by Tim Roughgarden and Gregory Valiant at Stanford.&lt;br /&gt;
* [https://www.cs.princeton.edu/courses/archive/fall18/cos521/ Advanced Algorithm Design] by Pravesh Kothari and Christopher Musco at Princeton.&lt;br /&gt;
* [http://www.cs.cmu.edu/afs/cs.cmu.edu/academic/class/15859-f11/www/ Linear and Semidefinite Programming (Advanced Algorithms)] by Anupam Gupta and Ryan O&#039;Donnell at CMU.&lt;br /&gt;
* [https://www.cs.cmu.edu/~odonnell/papers/cs-theory-toolkit-lecture-notes.pdf CS Theory Toolkit] by Ryan O&#039;Donnell at CMU.&lt;br /&gt;
* [https://cs.uwaterloo.ca/~lapchi/cs860/index.html Eigenvalues and Polynomials] by Lap Chi Lau at University of Waterloo.&lt;br /&gt;
* The [https://www.cs.cornell.edu/jeh/book.pdf &amp;quot;Foundations of Data Science&amp;quot; book] by Avrim Blum, John Hopcroft, and Ravindran Kannan.&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=%E9%AB%98%E7%BA%A7%E7%AE%97%E6%B3%95_(Fall_2024)/Problem_Set_1&amp;diff=12615</id>
		<title>高级算法 (Fall 2024)/Problem Set 1</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=%E9%AB%98%E7%BA%A7%E7%AE%97%E6%B3%95_(Fall_2024)/Problem_Set_1&amp;diff=12615"/>
		<updated>2024-09-28T12:39:25Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: /* Problem 3 (Hashing and Sketching) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*每道题目的解答都要有完整的解题过程，中英文不限。&lt;br /&gt;
&lt;br /&gt;
*我们推荐大家使用LaTeX, markdown等对作业进行排版。&lt;br /&gt;
&lt;br /&gt;
== Problem 1 (Min-cut/Max-cut) ==&lt;br /&gt;
For any &#039;&#039;&#039;&amp;lt;math&amp;gt;\alpha \ge 1&amp;lt;/math&amp;gt;&#039;&#039;&#039;, a cut is called an &#039;&#039;&#039;&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&#039;&#039;&#039;-approximate min-cut in a multigraph &#039;&#039;&#039;&amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;&#039;&#039;&#039; if the number of edges in it is at most &#039;&#039;&#039;&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&#039;&#039;&#039; times that of the min-cut.  Prove that the number of &#039;&#039;&#039;&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&#039;&#039;&#039;-approximate min-cuts in a multigraph &#039;&#039;&#039;&amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;&#039;&#039;&#039; is at most &#039;&#039;&#039;&amp;lt;math&amp;gt;n^{2\alpha} / 2&amp;lt;/math&amp;gt;&#039;&#039;&#039;.  (&#039;&#039;&#039;&#039;&#039;Hint&#039;&#039;&#039;&#039;&#039;: Run Karger&#039;s algorithm until it has &#039;&#039;&#039;&amp;lt;math&amp;gt;\lceil 2\alpha \rceil&amp;lt;/math&amp;gt;&#039;&#039;&#039; supernodes. What is the chance that a particular &#039;&#039;&#039;&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&#039;&#039;&#039;-approximate min-cut is still available? How many possible cuts does this collapsed graph have?)&lt;br /&gt;
&lt;br /&gt;
== Problem 2 (Fingerprinting) ==&lt;br /&gt;
Two rooted trees &amp;lt;math&amp;gt;T_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_2&amp;lt;/math&amp;gt; are said to be isomorphic if there exists a one to one mapping &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt; from the nodes of &amp;lt;math&amp;gt;T_1&amp;lt;/math&amp;gt; to those of &amp;lt;math&amp;gt;T_2&amp;lt;/math&amp;gt; satisfying the following condition: &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; is a child of &amp;lt;math&amp;gt;w&amp;lt;/math&amp;gt; in &amp;lt;math&amp;gt;T_1&amp;lt;/math&amp;gt; if and only if &amp;lt;math&amp;gt;f(v)&amp;lt;/math&amp;gt; is a child of &amp;lt;math&amp;gt;f(w)&amp;lt;/math&amp;gt; in &amp;lt;math&amp;gt;T_2&amp;lt;/math&amp;gt;. Observe that no ordering is assumed on the children of any vertex. Devise an efficient randomized algorithm for testing the isomorphism of rooted trees and analyze its performance. &#039;&#039;&#039;&#039;&#039;Hint:&#039;&#039;&#039;&#039;&#039; Recursively associate a polynomial &amp;lt;math&amp;gt;P_v&amp;lt;/math&amp;gt; with each vertex &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; in a tree &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Problem 3 (Hashing and Sketching) ==&lt;br /&gt;
In class, we saw how to estimate the number of distinct elements in a data stream using the Flajolet-Martin algorithm. Consider the following alternative formulation of the distinct elements problem: given an &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; dimensional vector &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt;, we want to process a stream of arbitrary increments to entries in &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt;. In other words, if we see a number &amp;lt;math&amp;gt;i\in 1,\dots,N&amp;lt;/math&amp;gt; in the stream, we update entry &amp;lt;math&amp;gt;x_i\gets x_i + 1&amp;lt;/math&amp;gt;. Our goal is to estimate &amp;lt;math&amp;gt;\left \|x\right \|_0&amp;lt;/math&amp;gt;, which measures the number of non-zero entries in &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt;. With &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; viewed as a histogram that maintains counts for &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; potential elements, &amp;lt;math&amp;gt;\left \|x\right \|_0&amp;lt;/math&amp;gt; is exactly the number of distinct elements processed. In this problem we will develop an alternative algorithm for estimating &amp;lt;math&amp;gt;\left \|x\right \|_0&amp;lt;/math&amp;gt; that can also handle &#039;&#039;&#039;decrements&#039;&#039;&#039; to entries in &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt;. Specifically, instead of the stream containing just indices &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;, it contains pairs &amp;lt;math&amp;gt;(i, +)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;(i, −)&amp;lt;/math&amp;gt;. On receiving &amp;lt;math&amp;gt;(i, +)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; should update so that &amp;lt;math&amp;gt;x_i\gets x_i + 1&amp;lt;/math&amp;gt; and on receiving &amp;lt;math&amp;gt;(i, −)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; should update so that &amp;lt;math&amp;gt;x_i\gets x_i - 1&amp;lt;/math&amp;gt;. For this problem we will assume that, at the end of our stream, each &amp;lt;math&amp;gt;x_i \ge 0&amp;lt;/math&amp;gt; (i.e. for a specific index we can’t receive more decrements than increments).&lt;br /&gt;
# Consider a simpler problem. For a given value &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, let’s design an algorithm that succeeds with probability &amp;lt;math&amp;gt;(1 − \delta)&amp;lt;/math&amp;gt;, outputing &#039;&#039;&#039;LOW&#039;&#039;&#039; if &amp;lt;math&amp;gt;T &amp;lt; \frac{1}{2}\left \|x\right \|_0&amp;lt;/math&amp;gt; and &#039;&#039;&#039;HIGH&#039;&#039;&#039; if &amp;lt;math&amp;gt;T &amp;gt; 2\left \|x\right \|_0&amp;lt;/math&amp;gt;:&lt;br /&gt;
#* Assume we have access to a completely random hash function &amp;lt;math&amp;gt;h(\cdot)&amp;lt;/math&amp;gt; that maps each &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; to a random point in &amp;lt;math&amp;gt;[0, 1]&amp;lt;/math&amp;gt;. We maintain the estimator &amp;lt;math&amp;gt;s=\sum_{i:h(i)&amp;lt;\frac{1}{2T}}x_i&amp;lt;/math&amp;gt; as we receive increment and decrement updates. Show that, at the end of our stream,    (i)  If &amp;lt;math&amp;gt;T &amp;lt; \frac{1}{2}\left \|x\right \|_0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\Pr_h[s=0]&amp;lt;1/e\approx 0.37&amp;lt;/math&amp;gt; and (ii)  If &amp;lt;math&amp;gt;T &amp;gt; 2\left \|x\right \|_0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\Pr_h[s=0]&amp;gt;0.5&amp;lt;/math&amp;gt;.&lt;br /&gt;
#* Using this fact, show how to use &amp;lt;math&amp;gt;k=O(\log 1/\delta)&amp;lt;/math&amp;gt; independent random hash functions, and corresponding individual estimators &amp;lt;math&amp;gt;s_1, s_2, . . . , s_k&amp;lt;/math&amp;gt;, to output &#039;&#039;&#039;LOW&#039;&#039;&#039; if &amp;lt;math&amp;gt;T &amp;lt; \frac{1}{2}\left \|x\right \|_0&amp;lt;/math&amp;gt; and &#039;&#039;&#039;HIGH&#039;&#039;&#039; if &amp;lt;math&amp;gt;T &amp;gt; 2\left \|x\right \|_0&amp;lt;/math&amp;gt;. If neither event occurs you can output either &#039;&#039;&#039;LOW&#039;&#039;&#039; or &#039;&#039;&#039;HIGH&#039;&#039;&#039;. Your algorithm should succeed with probability &amp;lt;math&amp;gt;(1 − \delta)&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Using &amp;lt;math&amp;gt;O(\log N)&amp;lt;/math&amp;gt; repetitions of your algorithm for the above decision problem (with &amp;lt;math&amp;gt;\delta&amp;lt;/math&amp;gt; set appropriately), show how to obtain an estimate &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; for &amp;lt;math&amp;gt;\left \|x\right \|_0&amp;lt;/math&amp;gt; such that &amp;lt;math&amp;gt;\frac{1}{4}\left \|x\right \|_0\le F\le 4\left \|x\right \|_0&amp;lt;/math&amp;gt; w.h.p.(with probability &amp;lt;math&amp;gt;1-O(1/N)&amp;lt;/math&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
== Problem 4 (Concentration of measure) ==&lt;br /&gt;
Consider the [[wikipedia:Erdős–Rényi_model#Definition|Erdős–Rényi random graph]] &amp;lt;math&amp;gt;G(n, p)&amp;lt;/math&amp;gt; where every two vertices in the graph are connected randomly and independently with probability &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;. We denote &amp;lt;math&amp;gt;G \sim G(n, p)&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; is generated in this way. Recall that &amp;lt;math&amp;gt;\chi(G)&amp;lt;/math&amp;gt; is the chromatic number of the graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(a.)&#039;&#039;&#039; For &amp;lt;math&amp;gt;0 &amp;lt; p_1 &amp;lt; p_2 &amp;lt; 1&amp;lt;/math&amp;gt;, let &amp;lt;math&amp;gt;G_1 \sim G(n, p_1)&amp;lt;/math&amp;gt; and let &amp;lt;math&amp;gt;G_2 \sim G(n, p_2)&amp;lt;/math&amp;gt;. Compare &amp;lt;math&amp;gt;\mathbf{E}[\chi(G_1)]&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{E}[\chi(G_2)]&amp;lt;/math&amp;gt; and prove it.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(b.)&#039;&#039;&#039; For &amp;lt;math&amp;gt;G \sim G(n, n^{-\alpha})&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\alpha &amp;gt; 5/6&amp;lt;/math&amp;gt; and constant &amp;lt;math&amp;gt;C &amp;gt; 0&amp;lt;/math&amp;gt;, prove that every subgraph of &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; on &amp;lt;math&amp;gt;C\sqrt{n \log n}&amp;lt;/math&amp;gt; vertices is &amp;lt;math&amp;gt;3&amp;lt;/math&amp;gt;-colorable with probability &amp;lt;math&amp;gt;1 - o(1)&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is large enough. (&#039;&#039;&#039;&#039;&#039;Hint&#039;&#039;&#039;&#039;&#039;: &amp;lt;math&amp;gt;\binom{n}{k} \leq (en/k)^k&amp;lt;/math&amp;gt;.)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(c.)&#039;&#039;&#039; For &amp;lt;math&amp;gt;G \sim G(n, n^{-\alpha})&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\alpha &amp;gt; 5/6&amp;lt;/math&amp;gt;, show that &amp;lt;math&amp;gt;\chi(G)&amp;lt;/math&amp;gt; is concentrated on four values with probability &amp;lt;math&amp;gt;1 - o(1)&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is large enough. To be more exact, show that there exists an integer &amp;lt;math&amp;gt;u&amp;lt;/math&amp;gt; such that &amp;lt;math&amp;gt;u \leq \chi(G) \leq u+3&amp;lt;/math&amp;gt; with probability &amp;lt;math&amp;gt;1 - o(1)&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is large enough.&lt;br /&gt;
&lt;br /&gt;
== Problem 5 (Dimension reduction) ==&lt;br /&gt;
[&#039;&#039;&#039;Inner product&#039;&#039;&#039;] Fix parameters &amp;lt;math&amp;gt;d&amp;gt;0, \delta,\epsilon\in(0,1)&amp;lt;/math&amp;gt;. Let &amp;lt;math&amp;gt;A\in \mathbb{R}^{k\times d}&amp;lt;/math&amp;gt; be a random matrix with &amp;lt;math&amp;gt;k = O(\log(1/\delta)/\epsilon^2)&amp;lt;/math&amp;gt; rows, and entries of &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; are chosen i.i.d. from Gaussian distribution with mean &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt; and variance &amp;lt;math&amp;gt;1/k&amp;lt;/math&amp;gt;. Prove that for any &amp;lt;math&amp;gt;x,y\in \mathbb{R}^d&amp;lt;/math&amp;gt;: &amp;lt;math&amp;gt;|x^\top y - (Ax)^\top(Ay)|\leq \epsilon(\|x\|_2^2 + \|y\|_2^2)&amp;lt;/math&amp;gt; with probability &amp;lt;math&amp;gt;\geq 1-\delta&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[&#039;&#039;&#039;Linear separability&#039;&#039;&#039;] In machine learning, the goal of many classification methods is to seperate data into classes using a hyperplane. A hyperplane in &amp;lt;math&amp;gt;\mathbb{R}^d&amp;lt;/math&amp;gt; is characterized by a unit vector &amp;lt;math&amp;gt;a\in \mathbb{R}^d (\|a\|_2 = 1)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;c\in \mathbb{R}&amp;lt;/math&amp;gt;. It contains all &amp;lt;math&amp;gt;z\in \mathbb{R}^d&amp;lt;/math&amp;gt; such that &amp;lt;math&amp;gt;a^\top z = c&amp;lt;/math&amp;gt;. Suppose our dataset consists of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; &#039;&#039;&#039;unit&#039;&#039;&#039; vectors in &amp;lt;math&amp;gt;\mathbb{R}^d&amp;lt;/math&amp;gt;. These points can be separated into two linearly separable sets &amp;lt;math&amp;gt;X,Y&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;|X|+|Y| = n&amp;lt;/math&amp;gt;. That is, for all &amp;lt;math&amp;gt;x\in X&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a^\top x&amp;gt;c&amp;lt;/math&amp;gt; and for all &amp;lt;math&amp;gt;y\in Y&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a^\top y&amp;lt;c&amp;lt;/math&amp;gt; (or vice versa). Furthermore, suppose that the &amp;lt;math&amp;gt;\ell_2&amp;lt;/math&amp;gt; distance of each point in &amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;Y&amp;lt;/math&amp;gt; to this separating hyperplane is at least &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;. When this is the case, the hyperplane is said to have margin &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Show that &amp;lt;math&amp;gt;X,Y&amp;lt;/math&amp;gt; can be separated by the hyperplane characterized by &amp;lt;math&amp;gt;a\in \mathbb{R}^d (\|a\|_2 = 1)&amp;lt;/math&amp;gt; and  &amp;lt;math&amp;gt;c\in \mathbb{R}&amp;lt;/math&amp;gt; with margin &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; is equivalent to the following condition: for all &amp;lt;math&amp;gt;x\in X&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a^\top x \geq c+\epsilon&amp;lt;/math&amp;gt; and for all &amp;lt;math&amp;gt;y\in Y&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a^\top y \leq c-\epsilon&amp;lt;/math&amp;gt; (or vice versa).&lt;br /&gt;
# Show that if we use a Johnson-Lindenstrauss map &amp;lt;math&amp;gt;A\in \mathbb{R}^{k\times d}&amp;lt;/math&amp;gt; (the scaled Gaussian matrix given in the lecture) to reduce our data points to &amp;lt;math&amp;gt;O(\log n/\epsilon^2)&amp;lt;/math&amp;gt; dimensions, then with probability at least &amp;lt;math&amp;gt;9/10&amp;lt;/math&amp;gt;, the dimension reduced data can still be separated by a hyperplane with margin &amp;lt;math&amp;gt;\epsilon/4&amp;lt;/math&amp;gt;. (&#039;&#039;&#039;&#039;&#039;Hint&#039;&#039;&#039;&#039;&#039;: use the fact that JLT preserves inner product.)&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=%E9%AB%98%E7%BA%A7%E7%AE%97%E6%B3%95_(Fall_2024)/Problem_Set_1&amp;diff=12606</id>
		<title>高级算法 (Fall 2024)/Problem Set 1</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=%E9%AB%98%E7%BA%A7%E7%AE%97%E6%B3%95_(Fall_2024)/Problem_Set_1&amp;diff=12606"/>
		<updated>2024-09-28T03:20:37Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: /* Problem 3 (Hashing) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*每道题目的解答都要有完整的解题过程，中英文不限。&lt;br /&gt;
&lt;br /&gt;
*我们推荐大家使用LaTeX, markdown等对作业进行排版。&lt;br /&gt;
&lt;br /&gt;
== Problem 1 (Min-cut/Max-cut) ==&lt;br /&gt;
For any &#039;&#039;&#039;&amp;lt;math&amp;gt;\alpha \ge 1&amp;lt;/math&amp;gt;&#039;&#039;&#039;, a cut is called an &#039;&#039;&#039;&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&#039;&#039;&#039;-approximate min-cut in a multigraph &#039;&#039;&#039;&amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;&#039;&#039;&#039; if the number of edges in it is at most &#039;&#039;&#039;&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&#039;&#039;&#039; times that of the min-cut.  Prove that the number of &#039;&#039;&#039;&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&#039;&#039;&#039;-approximate min-cuts in a multigraph &#039;&#039;&#039;&amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;&#039;&#039;&#039; is at most &#039;&#039;&#039;&amp;lt;math&amp;gt;n^{2\alpha} / 2&amp;lt;/math&amp;gt;&#039;&#039;&#039;.  (&#039;&#039;&#039;&#039;&#039;Hint&#039;&#039;&#039;&#039;&#039;: Run Karger&#039;s algorithm until it has &#039;&#039;&#039;&amp;lt;math&amp;gt;\lceil 2\alpha \rceil&amp;lt;/math&amp;gt;&#039;&#039;&#039; supernodes. What is the chance that a particular &#039;&#039;&#039;&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&#039;&#039;&#039;-approximate min-cut is still available? How many possible cuts does this collapsed graph have?)&lt;br /&gt;
&lt;br /&gt;
== Problem 2 (Fingerprinting) ==&lt;br /&gt;
Two rooted trees &amp;lt;math&amp;gt;T_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_2&amp;lt;/math&amp;gt; are said to be isomorphic if there exists a one to one mapping &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt; from the nodes of &amp;lt;math&amp;gt;T_1&amp;lt;/math&amp;gt; to those of &amp;lt;math&amp;gt;T_2&amp;lt;/math&amp;gt; satisfying the following condition: &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; is a child of &amp;lt;math&amp;gt;w&amp;lt;/math&amp;gt; in &amp;lt;math&amp;gt;T_1&amp;lt;/math&amp;gt; if and only if &amp;lt;math&amp;gt;f(v)&amp;lt;/math&amp;gt; is a child of &amp;lt;math&amp;gt;f(w)&amp;lt;/math&amp;gt; in &amp;lt;math&amp;gt;T_2&amp;lt;/math&amp;gt;. Observe that no ordering is assumed on the children of any vertex. Devise an efficient randomized algorithm for testing the isomorphism of rooted trees and analyze its performance. &#039;&#039;&#039;&#039;&#039;Hint:&#039;&#039;&#039;&#039;&#039; Recursively associate a polynomial &amp;lt;math&amp;gt;P_v&amp;lt;/math&amp;gt; with each vertex &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; in a tree &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Problem 3 (Hashing and Sketching) ==&lt;br /&gt;
Let &amp;lt;math&amp;gt;X_1,X_2,\ldots,X_n&amp;lt;/math&amp;gt; be &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; random variables, where each &amp;lt;math&amp;gt;X_i \in \{0, 1\}&amp;lt;/math&amp;gt; follows the distribution &amp;lt;math&amp;gt;\mu_i&amp;lt;/math&amp;gt;. For each &amp;lt;math&amp;gt;1\leq i \leq n&amp;lt;/math&amp;gt;, let &amp;lt;math&amp;gt;\rho_i = \mathbb{E}[X_i]&amp;lt;/math&amp;gt; and assume &amp;lt;math&amp;gt;\rho_i \geq \frac{1}{2}&amp;lt;/math&amp;gt;. Consider the problem of estimating the value of &lt;br /&gt;
:&amp;lt;math&amp;gt;Z = \prod_{i = 1}^n \rho_i&amp;lt;/math&amp;gt;.	&lt;br /&gt;
For each &amp;lt;math&amp;gt;1\leq  i \leq n&amp;lt;/math&amp;gt;, the algorithm draws &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; random samples &amp;lt;math&amp;gt;X_i^{(1)},X_i^{(2)},\ldots,X_i^{(s)}&amp;lt;/math&amp;gt; independently from the distribution &amp;lt;math&amp;gt;\mu_i&amp;lt;/math&amp;gt;, and computes &lt;br /&gt;
:&amp;lt;math&amp;gt;\widehat{\rho}_{i}=\frac{1}{s}\sum_{j=1}^s X_i^{(j)}&amp;lt;/math&amp;gt;.&lt;br /&gt;
Finally, the algorithm outputs the product of all &amp;lt;math&amp;gt;\widehat{Z}_{i}&amp;lt;/math&amp;gt;:&lt;br /&gt;
:&amp;lt;math&amp;gt;\widehat{Z}=\prod_{i= 1}^n\widehat{\rho}_i&amp;lt;/math&amp;gt;.&lt;br /&gt;
Express &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; as a function of &amp;lt;math&amp;gt;n,\varepsilon,\delta&amp;lt;/math&amp;gt; so that the output &amp;lt;math&amp;gt;\widehat{Z}&amp;lt;/math&amp;gt; satisfies&lt;br /&gt;
:&amp;lt;math&amp;gt;\Pr\left[(1 - \varepsilon) Z \leq \widehat{Z} \leq (1 + \varepsilon)Z\right] \geq 1- \delta&amp;lt;/math&amp;gt;.&lt;br /&gt;
Try to make &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; as small as possible.&lt;br /&gt;
&lt;br /&gt;
== Problem 4 (Concentration of measure) ==&lt;br /&gt;
Consider the [[wikipedia:Erdős–Rényi_model#Definition|Erdős–Rényi random graph]] &amp;lt;math&amp;gt;G(n, p)&amp;lt;/math&amp;gt; where every two vertices in the graph are connected randomly and independently with probability &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;. We denote &amp;lt;math&amp;gt;G \sim G(n, p)&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; is generated in this way. Recall that &amp;lt;math&amp;gt;\chi(G)&amp;lt;/math&amp;gt; is the chromatic number of the graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(a.)&#039;&#039;&#039; For &amp;lt;math&amp;gt;0 &amp;lt; p_1 &amp;lt; p_2 &amp;lt; 1&amp;lt;/math&amp;gt;, let &amp;lt;math&amp;gt;G_1 \sim G(n, p_1)&amp;lt;/math&amp;gt; and let &amp;lt;math&amp;gt;G_2 \sim G(n, p_2)&amp;lt;/math&amp;gt;. Compare &amp;lt;math&amp;gt;\mathbf{E}[\chi(G_1)]&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{E}[\chi(G_2)]&amp;lt;/math&amp;gt; and prove it.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(b.)&#039;&#039;&#039; For &amp;lt;math&amp;gt;G \sim G(n, n^{-\alpha})&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\alpha &amp;gt; 5/6&amp;lt;/math&amp;gt;, prove that there exists a constant &amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt; such that  every subgraph of &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; on &amp;lt;math&amp;gt;C\sqrt{n}&amp;lt;/math&amp;gt; vertices is &amp;lt;math&amp;gt;3&amp;lt;/math&amp;gt;-colorable with probability &amp;lt;math&amp;gt;1 - o(1)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(c.)&#039;&#039;&#039; For &amp;lt;math&amp;gt;G \sim G(n, n^{-\alpha})&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\alpha &amp;gt; 5/6&amp;lt;/math&amp;gt;, show that &amp;lt;math&amp;gt;\chi(G)&amp;lt;/math&amp;gt; is concentrated on four values with probability at least &amp;lt;math&amp;gt;1 - o(1)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Problem 5 (Dimension reduction) ==&lt;br /&gt;
In machine learning, the goal of many classification methods is to seperate data into classes using a hyperplane. A hyperplane in &amp;lt;math&amp;gt;\mathbb{R}^d&amp;lt;/math&amp;gt; is characterized by a unit vector &amp;lt;math&amp;gt;a\in \mathbb{R}^d (\|a\|_2 = 1)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;c\in \mathbb{R}&amp;lt;/math&amp;gt;. It contains all &amp;lt;math&amp;gt;z\in \mathbb{R}^d&amp;lt;/math&amp;gt; such that &amp;lt;math&amp;gt;a^\top z = c&amp;lt;/math&amp;gt;. Suppose our dataset consists of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; &#039;&#039;&#039;unit&#039;&#039;&#039; vectors in &amp;lt;math&amp;gt;\mathbb{R}^d&amp;lt;/math&amp;gt;. These points can be separated into two linearly separable sets &amp;lt;math&amp;gt;X,Y&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;|X|+|Y| = n&amp;lt;/math&amp;gt;. That is, for all &amp;lt;math&amp;gt;x\in X&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a^\top x&amp;gt;c&amp;lt;/math&amp;gt; and for all &amp;lt;math&amp;gt;y\in Y&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a^\top y&amp;lt;c&amp;lt;/math&amp;gt; (or vice versa). Furthermore, suppose that the &amp;lt;math&amp;gt;\ell_2&amp;lt;/math&amp;gt; distance of each point in &amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;Y&amp;lt;/math&amp;gt; to this separating hyperplane is at least &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;. When this is the case, the hyperplane is said to have margin &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Show that &amp;lt;math&amp;gt;X,Y&amp;lt;/math&amp;gt; can be separated by the hyperplane characterized by &amp;lt;math&amp;gt;a\in \mathbb{R}^d (\|a\|_2 = 1)&amp;lt;/math&amp;gt; and  &amp;lt;math&amp;gt;c\in \mathbb{R}&amp;lt;/math&amp;gt; with margin &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; is equivalent to the following condition: for all &amp;lt;math&amp;gt;x\in X&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a^\top x &amp;gt;c+\epsilon&amp;lt;/math&amp;gt; and for all &amp;lt;math&amp;gt;y\in Y&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a^\top y &amp;lt; c-\epsilon&amp;lt;/math&amp;gt; (or vice versa).&lt;br /&gt;
# Show that if we use a Johnson-Lindenstrauss map &amp;lt;math&amp;gt;A\in \mathbb{R}^{k\times d}&amp;lt;/math&amp;gt; (the scaled Gaussian matrix given in the lecture) to reduce our data points to &amp;lt;math&amp;gt;O(\log n/\epsilon^2)&amp;lt;/math&amp;gt; dimensions, then with probability at least &amp;lt;math&amp;gt;9/10&amp;lt;/math&amp;gt;, the dimension reduced data can still be separated by a hyperplane with margin &amp;lt;math&amp;gt;\epsilon/4&amp;lt;/math&amp;gt;. (&#039;&#039;&#039;&#039;&#039;Hint&#039;&#039;&#039;&#039;&#039;: use the fact that JLT preserves inner product.)&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=%E9%AB%98%E7%BA%A7%E7%AE%97%E6%B3%95_(Fall_2024)/Problem_Set_1&amp;diff=12605</id>
		<title>高级算法 (Fall 2024)/Problem Set 1</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=%E9%AB%98%E7%BA%A7%E7%AE%97%E6%B3%95_(Fall_2024)/Problem_Set_1&amp;diff=12605"/>
		<updated>2024-09-28T03:15:20Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: /* Problem 3 (Hashing) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*每道题目的解答都要有完整的解题过程，中英文不限。&lt;br /&gt;
&lt;br /&gt;
*我们推荐大家使用LaTeX, markdown等对作业进行排版。&lt;br /&gt;
&lt;br /&gt;
== Problem 1 (Min-cut/Max-cut) ==&lt;br /&gt;
For any &#039;&#039;&#039;&amp;lt;math&amp;gt;\alpha \ge 1&amp;lt;/math&amp;gt;&#039;&#039;&#039;, a cut is called an &#039;&#039;&#039;&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&#039;&#039;&#039;-approximate min-cut in a multigraph &#039;&#039;&#039;&amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;&#039;&#039;&#039; if the number of edges in it is at most &#039;&#039;&#039;&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&#039;&#039;&#039; times that of the min-cut.  Prove that the number of &#039;&#039;&#039;&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&#039;&#039;&#039;-approximate min-cuts in a multigraph &#039;&#039;&#039;&amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;&#039;&#039;&#039; is at most &#039;&#039;&#039;&amp;lt;math&amp;gt;n^{2\alpha} / 2&amp;lt;/math&amp;gt;&#039;&#039;&#039;.  (&#039;&#039;&#039;&#039;&#039;Hint&#039;&#039;&#039;&#039;&#039;: Run Karger&#039;s algorithm until it has &#039;&#039;&#039;&amp;lt;math&amp;gt;\lceil 2\alpha \rceil&amp;lt;/math&amp;gt;&#039;&#039;&#039; supernodes. What is the chance that a particular &#039;&#039;&#039;&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&#039;&#039;&#039;-approximate min-cut is still available? How many possible cuts does this collapsed graph have?)&lt;br /&gt;
&lt;br /&gt;
== Problem 2 (Fingerprinting) ==&lt;br /&gt;
Two rooted trees &amp;lt;math&amp;gt;T_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_2&amp;lt;/math&amp;gt; are said to be isomorphic if there exists a one to one mapping &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt; from the nodes of &amp;lt;math&amp;gt;T_1&amp;lt;/math&amp;gt; to those of &amp;lt;math&amp;gt;T_2&amp;lt;/math&amp;gt; satisfying the following condition: &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; is a child of &amp;lt;math&amp;gt;w&amp;lt;/math&amp;gt; in &amp;lt;math&amp;gt;T_1&amp;lt;/math&amp;gt; if and only if &amp;lt;math&amp;gt;f(v)&amp;lt;/math&amp;gt; is a child of &amp;lt;math&amp;gt;f(w)&amp;lt;/math&amp;gt; in &amp;lt;math&amp;gt;T_2&amp;lt;/math&amp;gt;. Observe that no ordering is assumed on the children of any vertex. Devise an efficient randomized algorithm for testing the isomorphism of rooted trees and analyze its performance. &#039;&#039;&#039;&#039;&#039;Hint:&#039;&#039;&#039;&#039;&#039; Recursively associate a polynomial &amp;lt;math&amp;gt;P_v&amp;lt;/math&amp;gt; with each vertex &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; in a tree &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Problem 3 (Hashing) ==&lt;br /&gt;
Let &amp;lt;math&amp;gt;X_1,X_2,\ldots,X_n&amp;lt;/math&amp;gt; be &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; random variables, where each &amp;lt;math&amp;gt;X_i \in \{0, 1\}&amp;lt;/math&amp;gt; follows the distribution &amp;lt;math&amp;gt;\mu_i&amp;lt;/math&amp;gt;. For each &amp;lt;math&amp;gt;1\leq i \leq n&amp;lt;/math&amp;gt;, let &amp;lt;math&amp;gt;\rho_i = \mathbb{E}[X_i]&amp;lt;/math&amp;gt; and assume &amp;lt;math&amp;gt;\rho_i \geq \frac{1}{2}&amp;lt;/math&amp;gt;. Consider the problem of estimating the value of &lt;br /&gt;
:&amp;lt;math&amp;gt;Z = \prod_{i = 1}^n \rho_i&amp;lt;/math&amp;gt;.	&lt;br /&gt;
For each &amp;lt;math&amp;gt;1\leq  i \leq n&amp;lt;/math&amp;gt;, the algorithm draws &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; random samples &amp;lt;math&amp;gt;X_i^{(1)},X_i^{(2)},\ldots,X_i^{(s)}&amp;lt;/math&amp;gt; independently from the distribution &amp;lt;math&amp;gt;\mu_i&amp;lt;/math&amp;gt;, and computes &lt;br /&gt;
:&amp;lt;math&amp;gt;\widehat{\rho}_{i}=\frac{1}{s}\sum_{j=1}^s X_i^{(j)}&amp;lt;/math&amp;gt;.&lt;br /&gt;
Finally, the algorithm outputs the product of all &amp;lt;math&amp;gt;\widehat{Z}_{i}&amp;lt;/math&amp;gt;:&lt;br /&gt;
:&amp;lt;math&amp;gt;\widehat{Z}=\prod_{i= 1}^n\widehat{\rho}_i&amp;lt;/math&amp;gt;.&lt;br /&gt;
Express &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; as a function of &amp;lt;math&amp;gt;n,\varepsilon,\delta&amp;lt;/math&amp;gt; so that the output &amp;lt;math&amp;gt;\widehat{Z}&amp;lt;/math&amp;gt; satisfies&lt;br /&gt;
:&amp;lt;math&amp;gt;\Pr\left[(1 - \varepsilon) Z \leq \widehat{Z} \leq (1 + \varepsilon)Z\right] \geq 1- \delta&amp;lt;/math&amp;gt;.&lt;br /&gt;
Try to make &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; as small as possible.&lt;br /&gt;
&lt;br /&gt;
== Problem 4 (Concentration of measure) ==&lt;br /&gt;
Consider the [[wikipedia:Erdős–Rényi_model#Definition|Erdős–Rényi random graph]] &amp;lt;math&amp;gt;G(n, p)&amp;lt;/math&amp;gt; where every two vertices in the graph are connected randomly and independently with probability &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;. We denote &amp;lt;math&amp;gt;G \sim G(n, p)&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; is generated in this way. Recall that &amp;lt;math&amp;gt;\chi(G)&amp;lt;/math&amp;gt; is the chromatic number of the graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(a.)&#039;&#039;&#039; For &amp;lt;math&amp;gt;0 &amp;lt; p_1 &amp;lt; p_2 &amp;lt; 1&amp;lt;/math&amp;gt;, let &amp;lt;math&amp;gt;G_1 \sim G(n, p_1)&amp;lt;/math&amp;gt; and let &amp;lt;math&amp;gt;G_2 \sim G(n, p_2)&amp;lt;/math&amp;gt;. Compare &amp;lt;math&amp;gt;\mathbf{E}[\chi(G_1)]&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{E}[\chi(G_2)]&amp;lt;/math&amp;gt; and prove it.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(b.)&#039;&#039;&#039; For &amp;lt;math&amp;gt;G \sim G(n, n^{-\alpha})&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\alpha &amp;gt; 5/6&amp;lt;/math&amp;gt;, prove that there exists a constant &amp;lt;math&amp;gt;C&amp;lt;/math&amp;gt; such that  every subgraph of &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; on &amp;lt;math&amp;gt;C\sqrt{n}&amp;lt;/math&amp;gt; vertices is &amp;lt;math&amp;gt;3&amp;lt;/math&amp;gt;-colorable with probability &amp;lt;math&amp;gt;1 - o(1)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(c.)&#039;&#039;&#039; For &amp;lt;math&amp;gt;G \sim G(n, n^{-\alpha})&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\alpha &amp;gt; 5/6&amp;lt;/math&amp;gt;, show that &amp;lt;math&amp;gt;\chi(G)&amp;lt;/math&amp;gt; is concentrated on four values with probability at least &amp;lt;math&amp;gt;1 - o(1)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Problem 5 (Dimension reduction) ==&lt;br /&gt;
In machine learning, the goal of many classification methods is to seperate data into classes using a hyperplane. A hyperplane in &amp;lt;math&amp;gt;\mathbb{R}^d&amp;lt;/math&amp;gt; is characterized by a unit vector &amp;lt;math&amp;gt;a\in \mathbb{R}^d (\|a\|_2 = 1)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;c\in \mathbb{R}&amp;lt;/math&amp;gt;. It contains all &amp;lt;math&amp;gt;z\in \mathbb{R}^d&amp;lt;/math&amp;gt; such that &amp;lt;math&amp;gt;a^\top z = c&amp;lt;/math&amp;gt;. Suppose our dataset consists of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; &#039;&#039;&#039;unit&#039;&#039;&#039; vectors in &amp;lt;math&amp;gt;\mathbb{R}^d&amp;lt;/math&amp;gt;. These points can be separated into two linearly separable sets &amp;lt;math&amp;gt;X,Y&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;|X|+|Y| = n&amp;lt;/math&amp;gt;. That is, for all &amp;lt;math&amp;gt;x\in X&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a^\top x&amp;gt;c&amp;lt;/math&amp;gt; and for all &amp;lt;math&amp;gt;y\in Y&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a^\top y&amp;lt;c&amp;lt;/math&amp;gt; (or vice versa). Furthermore, suppose that the &amp;lt;math&amp;gt;\ell_2&amp;lt;/math&amp;gt; distance of each point in &amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;Y&amp;lt;/math&amp;gt; to this separating hyperplane is at least &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;. When this is the case, the hyperplane is said to have margin &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Show that &amp;lt;math&amp;gt;X,Y&amp;lt;/math&amp;gt; can be separated by the hyperplane characterized by &amp;lt;math&amp;gt;a\in \mathbb{R}^d (\|a\|_2 = 1)&amp;lt;/math&amp;gt; and  &amp;lt;math&amp;gt;c\in \mathbb{R}&amp;lt;/math&amp;gt; with margin &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; is equivalent to the following condition: for all &amp;lt;math&amp;gt;x\in X&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a^\top x &amp;gt;c+\epsilon&amp;lt;/math&amp;gt; and for all &amp;lt;math&amp;gt;y\in Y&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a^\top y &amp;lt; c-\epsilon&amp;lt;/math&amp;gt; (or vice versa).&lt;br /&gt;
# Show that if we use a Johnson-Lindenstrauss map &amp;lt;math&amp;gt;A\in \mathbb{R}^{k\times d}&amp;lt;/math&amp;gt; (the scaled Gaussian matrix given in the lecture) to reduce our data points to &amp;lt;math&amp;gt;O(\log n/\epsilon^2)&amp;lt;/math&amp;gt; dimensions, then with probability at least &amp;lt;math&amp;gt;9/10&amp;lt;/math&amp;gt;, the dimension reduced data can still be separated by a hyperplane with margin &amp;lt;math&amp;gt;\epsilon/4&amp;lt;/math&amp;gt;. (&#039;&#039;&#039;&#039;&#039;Hint&#039;&#039;&#039;&#039;&#039;: use the fact that JLT preserves inner product.)&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=%E9%AB%98%E7%BA%A7%E7%AE%97%E6%B3%95_(Fall_2024)/Problem_Set_1&amp;diff=12602</id>
		<title>高级算法 (Fall 2024)/Problem Set 1</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=%E9%AB%98%E7%BA%A7%E7%AE%97%E6%B3%95_(Fall_2024)/Problem_Set_1&amp;diff=12602"/>
		<updated>2024-09-28T03:07:03Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: /* Problem 2 (Fingerprinting) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*每道题目的解答都要有完整的解题过程，中英文不限。&lt;br /&gt;
&lt;br /&gt;
*我们推荐大家使用LaTeX, markdown等对作业进行排版。&lt;br /&gt;
&lt;br /&gt;
== Problem 1 (Min-cut/Max-cut) ==&lt;br /&gt;
For any &#039;&#039;&#039;&amp;lt;math&amp;gt;\alpha \ge 1&amp;lt;/math&amp;gt;&#039;&#039;&#039;, a cut is called an &#039;&#039;&#039;&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&#039;&#039;&#039;-approximate min-cut in a multigraph &#039;&#039;&#039;&amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;&#039;&#039;&#039; if the number of edges in it is at most &#039;&#039;&#039;&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&#039;&#039;&#039; times that of the min-cut.  Prove that the number of &#039;&#039;&#039;&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&#039;&#039;&#039;-approximate min-cuts in a multigraph &#039;&#039;&#039;&amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;&#039;&#039;&#039; is at most &#039;&#039;&#039;&amp;lt;math&amp;gt;n^{2\alpha} / 2&amp;lt;/math&amp;gt;&#039;&#039;&#039;.  (&#039;&#039;&#039;&#039;&#039;Hint&#039;&#039;&#039;&#039;&#039;: Run Karger&#039;s algorithm until it has &#039;&#039;&#039;&amp;lt;math&amp;gt;\lceil 2\alpha \rceil&amp;lt;/math&amp;gt;&#039;&#039;&#039; supernodes. What is the chance that a particular &#039;&#039;&#039;&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&#039;&#039;&#039;-approximate min-cut is still available? How many possible cuts does this collapsed graph have?)&lt;br /&gt;
&lt;br /&gt;
== Problem 2 (Fingerprinting) ==&lt;br /&gt;
Two rooted trees &amp;lt;math&amp;gt;T_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_2&amp;lt;/math&amp;gt; are said to be isomorphic if there exists a one to one mapping &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt; from the nodes of &amp;lt;math&amp;gt;T_1&amp;lt;/math&amp;gt; to those of &amp;lt;math&amp;gt;T_2&amp;lt;/math&amp;gt; satisfying the following condition: &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; is a child of &amp;lt;math&amp;gt;w&amp;lt;/math&amp;gt; in &amp;lt;math&amp;gt;T_1&amp;lt;/math&amp;gt; if and only if &amp;lt;math&amp;gt;f(v)&amp;lt;/math&amp;gt; is a child of &amp;lt;math&amp;gt;f(w)&amp;lt;/math&amp;gt; in &amp;lt;math&amp;gt;T_2&amp;lt;/math&amp;gt;. Observe that no ordering is assumed on the children of any vertex. Devise an efficient randomized algorithm for testing the isomorphism of rooted trees and analyze its performance. &#039;&#039;&#039;&#039;&#039;Hint:&#039;&#039;&#039;&#039;&#039; Recursively associate a polynomial &amp;lt;math&amp;gt;P_v&amp;lt;/math&amp;gt; with each vertex &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; in a tree &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Problem 3 (Hashing) ==&lt;br /&gt;
&lt;br /&gt;
== Problem 4 (Concentration of measure) ==&lt;br /&gt;
&lt;br /&gt;
== Problem 5 (Dimension reduction) ==&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=%E9%AB%98%E7%BA%A7%E7%AE%97%E6%B3%95_(Fall_2024)/Problem_Set_1&amp;diff=12601</id>
		<title>高级算法 (Fall 2024)/Problem Set 1</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=%E9%AB%98%E7%BA%A7%E7%AE%97%E6%B3%95_(Fall_2024)/Problem_Set_1&amp;diff=12601"/>
		<updated>2024-09-28T03:01:18Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: /* Problem 1 (Min-cut/Max-cut) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*每道题目的解答都要有完整的解题过程，中英文不限。&lt;br /&gt;
&lt;br /&gt;
*我们推荐大家使用LaTeX, markdown等对作业进行排版。&lt;br /&gt;
&lt;br /&gt;
== Problem 1 (Min-cut/Max-cut) ==&lt;br /&gt;
For any &#039;&#039;&#039;&amp;lt;math&amp;gt;\alpha \ge 1&amp;lt;/math&amp;gt;&#039;&#039;&#039;, a cut is called an &#039;&#039;&#039;&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&#039;&#039;&#039;-approximate min-cut in a multigraph &#039;&#039;&#039;&amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;&#039;&#039;&#039; if the number of edges in it is at most &#039;&#039;&#039;&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&#039;&#039;&#039; times that of the min-cut.  Prove that the number of &#039;&#039;&#039;&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&#039;&#039;&#039;-approximate min-cuts in a multigraph &#039;&#039;&#039;&amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;&#039;&#039;&#039; is at most &#039;&#039;&#039;&amp;lt;math&amp;gt;n^{2\alpha} / 2&amp;lt;/math&amp;gt;&#039;&#039;&#039;.  (&#039;&#039;&#039;&#039;&#039;Hint&#039;&#039;&#039;&#039;&#039;: Run Karger&#039;s algorithm until it has &#039;&#039;&#039;&amp;lt;math&amp;gt;\lceil 2\alpha \rceil&amp;lt;/math&amp;gt;&#039;&#039;&#039; supernodes. What is the chance that a particular &#039;&#039;&#039;&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&#039;&#039;&#039;-approximate min-cut is still available? How many possible cuts does this collapsed graph have?)&lt;br /&gt;
&lt;br /&gt;
== Problem 2 (Fingerprinting) ==&lt;br /&gt;
Design a randomized algorithm to decide if an integer sequence &amp;lt;math&amp;gt;a_1,...,a_n&amp;lt;/math&amp;gt; is a permutation of another integer sequence &amp;lt;math&amp;gt;b_1,...,b_n&amp;lt;/math&amp;gt;. Give upper bounds on the time complexity and the error probability.&lt;br /&gt;
&lt;br /&gt;
== Problem 3 (Hashing) ==&lt;br /&gt;
&lt;br /&gt;
== Problem 4 (Concentration of measure) ==&lt;br /&gt;
&lt;br /&gt;
== Problem 5 (Dimension reduction) ==&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=%E9%AB%98%E7%BA%A7%E7%AE%97%E6%B3%95_(Fall_2024)/Problem_Set_1&amp;diff=12600</id>
		<title>高级算法 (Fall 2024)/Problem Set 1</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=%E9%AB%98%E7%BA%A7%E7%AE%97%E6%B3%95_(Fall_2024)/Problem_Set_1&amp;diff=12600"/>
		<updated>2024-09-28T03:00:12Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: /* Problem 2 (Fingerprinting) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*每道题目的解答都要有完整的解题过程，中英文不限。&lt;br /&gt;
&lt;br /&gt;
*我们推荐大家使用LaTeX, markdown等对作业进行排版。&lt;br /&gt;
&lt;br /&gt;
== Problem 1 (Min-cut/Max-cut) ==&lt;br /&gt;
[&#039;&#039;&#039;Counting &amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;-approximate min-cut&#039;&#039;&#039;] For any &#039;&#039;&#039;&amp;lt;math&amp;gt;\alpha \ge 1&amp;lt;/math&amp;gt;&#039;&#039;&#039;, a cut is called an &#039;&#039;&#039;&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&#039;&#039;&#039;-approximate min-cut in a multigraph &#039;&#039;&#039;&amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;&#039;&#039;&#039; if the number of edges in it is at most &#039;&#039;&#039;&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&#039;&#039;&#039; times that of the min-cut.  Prove that the number of &#039;&#039;&#039;&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&#039;&#039;&#039;-approximate min-cuts in a multigraph &#039;&#039;&#039;&amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;&#039;&#039;&#039; is at most &#039;&#039;&#039;&amp;lt;math&amp;gt;n^{2\alpha} / 2&amp;lt;/math&amp;gt;&#039;&#039;&#039;.  (&#039;&#039;&#039;&#039;&#039;Hint&#039;&#039;&#039;&#039;&#039;: Run Karger&#039;s algorithm until it has &#039;&#039;&#039;&amp;lt;math&amp;gt;\lceil 2\alpha \rceil&amp;lt;/math&amp;gt;&#039;&#039;&#039; supernodes. What is the chance that a particular &#039;&#039;&#039;&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&#039;&#039;&#039;-approximate min-cut is still available? How many possible cuts does this collapsed graph have?)&lt;br /&gt;
&lt;br /&gt;
== Problem 2 (Fingerprinting) ==&lt;br /&gt;
Design a randomized algorithm to decide if an integer sequence &amp;lt;math&amp;gt;a_1,...,a_n&amp;lt;/math&amp;gt; is a permutation of another integer sequence &amp;lt;math&amp;gt;b_1,...,b_n&amp;lt;/math&amp;gt;. Give upper bounds on the time complexity and the error probability.&lt;br /&gt;
&lt;br /&gt;
== Problem 3 (Hashing) ==&lt;br /&gt;
&lt;br /&gt;
== Problem 4 (Concentration of measure) ==&lt;br /&gt;
&lt;br /&gt;
== Problem 5 (Dimension reduction) ==&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=%E9%AB%98%E7%BA%A7%E7%AE%97%E6%B3%95_(Fall_2024)/Problem_Set_1&amp;diff=12599</id>
		<title>高级算法 (Fall 2024)/Problem Set 1</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=%E9%AB%98%E7%BA%A7%E7%AE%97%E6%B3%95_(Fall_2024)/Problem_Set_1&amp;diff=12599"/>
		<updated>2024-09-28T02:08:08Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: /* Problem 1 (Min-cut/Max-cut) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*每道题目的解答都要有完整的解题过程，中英文不限。&lt;br /&gt;
&lt;br /&gt;
*我们推荐大家使用LaTeX, markdown等对作业进行排版。&lt;br /&gt;
&lt;br /&gt;
== Problem 1 (Min-cut/Max-cut) ==&lt;br /&gt;
[&#039;&#039;&#039;Counting &amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;-approximate min-cut&#039;&#039;&#039;] For any &#039;&#039;&#039;&amp;lt;math&amp;gt;\alpha \ge 1&amp;lt;/math&amp;gt;&#039;&#039;&#039;, a cut is called an &#039;&#039;&#039;&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&#039;&#039;&#039;-approximate min-cut in a multigraph &#039;&#039;&#039;&amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;&#039;&#039;&#039; if the number of edges in it is at most &#039;&#039;&#039;&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&#039;&#039;&#039; times that of the min-cut.  Prove that the number of &#039;&#039;&#039;&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&#039;&#039;&#039;-approximate min-cuts in a multigraph &#039;&#039;&#039;&amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;&#039;&#039;&#039; is at most &#039;&#039;&#039;&amp;lt;math&amp;gt;n^{2\alpha} / 2&amp;lt;/math&amp;gt;&#039;&#039;&#039;.  (&#039;&#039;&#039;&#039;&#039;Hint&#039;&#039;&#039;&#039;&#039;: Run Karger&#039;s algorithm until it has &#039;&#039;&#039;&amp;lt;math&amp;gt;\lceil 2\alpha \rceil&amp;lt;/math&amp;gt;&#039;&#039;&#039; supernodes. What is the chance that a particular &#039;&#039;&#039;&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&#039;&#039;&#039;-approximate min-cut is still available? How many possible cuts does this collapsed graph have?)&lt;br /&gt;
&lt;br /&gt;
== Problem 2 (Fingerprinting) ==&lt;br /&gt;
&lt;br /&gt;
== Problem 3 (Hashing) ==&lt;br /&gt;
&lt;br /&gt;
== Problem 4 (Concentration of measure) ==&lt;br /&gt;
&lt;br /&gt;
== Problem 5 (Dimension reduction) ==&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=%E9%AB%98%E7%BA%A7%E7%AE%97%E6%B3%95_(Fall_2024)/Problem_Set_1&amp;diff=12596</id>
		<title>高级算法 (Fall 2024)/Problem Set 1</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=%E9%AB%98%E7%BA%A7%E7%AE%97%E6%B3%95_(Fall_2024)/Problem_Set_1&amp;diff=12596"/>
		<updated>2024-09-27T06:38:21Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: Created page with &amp;quot;*每道题目的解答都要有完整的解题过程，中英文不限。  *我们推荐大家使用LaTeX, markdown等对作业进行排版。  == Problem 1 (Min-cut/Max-cut) ==  == Problem 2 (Fingerprinting) ==  == Problem 3 (Hashing) ==  == Problem 4 (Concentration of measure) ==  == Problem 5 (Dimension reduction) ==&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*每道题目的解答都要有完整的解题过程，中英文不限。&lt;br /&gt;
&lt;br /&gt;
*我们推荐大家使用LaTeX, markdown等对作业进行排版。&lt;br /&gt;
&lt;br /&gt;
== Problem 1 (Min-cut/Max-cut) ==&lt;br /&gt;
&lt;br /&gt;
== Problem 2 (Fingerprinting) ==&lt;br /&gt;
&lt;br /&gt;
== Problem 3 (Hashing) ==&lt;br /&gt;
&lt;br /&gt;
== Problem 4 (Concentration of measure) ==&lt;br /&gt;
&lt;br /&gt;
== Problem 5 (Dimension reduction) ==&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=%E9%AB%98%E7%BA%A7%E7%AE%97%E6%B3%95_(Fall_2024)&amp;diff=12565</id>
		<title>高级算法 (Fall 2024)</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=%E9%AB%98%E7%BA%A7%E7%AE%97%E6%B3%95_(Fall_2024)&amp;diff=12565"/>
		<updated>2024-09-07T09:07:39Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox&lt;br /&gt;
|name         = Infobox&lt;br /&gt;
|bodystyle    = &lt;br /&gt;
|title        = &amp;lt;font size=3&amp;gt;高级算法 &lt;br /&gt;
&amp;lt;br&amp;gt;Advanced Algorithms&amp;lt;/font&amp;gt;&lt;br /&gt;
|titlestyle   = &lt;br /&gt;
&lt;br /&gt;
|image        = &lt;br /&gt;
|imagestyle   = &lt;br /&gt;
|caption      = &lt;br /&gt;
|captionstyle = &lt;br /&gt;
|headerstyle  = background:#ccf;&lt;br /&gt;
|labelstyle   = background:#ddf;&lt;br /&gt;
|datastyle    = &lt;br /&gt;
&lt;br /&gt;
|header1 =Instructor&lt;br /&gt;
|label1  = &lt;br /&gt;
|data1   = &lt;br /&gt;
|header2 = &lt;br /&gt;
|label2  = &lt;br /&gt;
|data2   = &#039;&#039;&#039;尹一通&#039;&#039;&#039;&lt;br /&gt;
|header3 = &lt;br /&gt;
|label3  = Email&lt;br /&gt;
|data3   = yinyt@nju.edu.cn &lt;br /&gt;
|header4 =&lt;br /&gt;
|label4= office&lt;br /&gt;
|data4= 计算机系 804&lt;br /&gt;
|header5 = &lt;br /&gt;
|label5  = &lt;br /&gt;
|data5   = &#039;&#039;&#039;栗师&#039;&#039;&#039;&lt;br /&gt;
|header6 = &lt;br /&gt;
|label6  = Email&lt;br /&gt;
|data6   = shili@nju.edu.cn &lt;br /&gt;
|header7 =&lt;br /&gt;
|label7= office&lt;br /&gt;
|data7= 计算机系 605&lt;br /&gt;
|header8 = &lt;br /&gt;
|label8  = &lt;br /&gt;
|data8   = &#039;&#039;&#039;刘景铖&#039;&#039;&#039;&lt;br /&gt;
|header9 = &lt;br /&gt;
|label9  = Email&lt;br /&gt;
|data9   = liu@nju.edu.cn &lt;br /&gt;
|header10 =&lt;br /&gt;
|label10= office&lt;br /&gt;
|data10= 计算机系 516&lt;br /&gt;
|header11 = Class&lt;br /&gt;
|label11  = &lt;br /&gt;
|data11   = &lt;br /&gt;
|header12 =&lt;br /&gt;
|label12  = Class meetings&lt;br /&gt;
|data12   = Monday (单), 4pm-6pm &amp;lt;br&amp;gt; Thursday, 2pm-4pm &amp;lt;br&amp;gt;仙Ⅰ-206&lt;br /&gt;
|header13 =&lt;br /&gt;
|label13  = Place&lt;br /&gt;
|data13   = &lt;br /&gt;
|header14 =&lt;br /&gt;
|label14  = Office hours&lt;br /&gt;
|data14   = Monday, 2pm-4pm, &amp;lt;br&amp;gt;计算机系 804&amp;lt;br&amp;gt;&lt;br /&gt;
|header15 = Textbooks&lt;br /&gt;
|label15  = &lt;br /&gt;
|data15   = &lt;br /&gt;
|header16 =&lt;br /&gt;
|label16  = &lt;br /&gt;
|data16   = [[File:MR-randomized-algorithms.png|border|100px]]&lt;br /&gt;
|header17 =&lt;br /&gt;
|label17  = &lt;br /&gt;
|data17   = Motwani and Raghavan. &amp;lt;br&amp;gt;&#039;&#039;Randomized Algorithms&#039;&#039;.&amp;lt;br&amp;gt; Cambridge Univ Press, 1995.&lt;br /&gt;
|header18 =&lt;br /&gt;
|label18  = &lt;br /&gt;
|data18   = [[File:Approximation_Algorithms.jpg|border|100px]]&lt;br /&gt;
|header19 =&lt;br /&gt;
|label19  = &lt;br /&gt;
|data19   =  Vazirani. &amp;lt;br&amp;gt;&#039;&#039;Approximation Algorithms&#039;&#039;. &amp;lt;br&amp;gt; Springer-Verlag, 2001.&lt;br /&gt;
|belowstyle = background:#ddf;&lt;br /&gt;
|below = &lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
This is the webpage for the &#039;&#039;Advanced Algorithms&#039;&#039; class of fall 2024. Students who take this class should check this page periodically for content updates and new announcements. &lt;br /&gt;
&lt;br /&gt;
= Announcement =&lt;br /&gt;
&lt;br /&gt;
* TBA&lt;br /&gt;
&lt;br /&gt;
= Course info =&lt;br /&gt;
* &#039;&#039;&#039;Instructor &#039;&#039;&#039;: &lt;br /&gt;
:* [http://tcs.nju.edu.cn/yinyt/ 尹一通]：[mailto:yinyt@nju.edu.cn &amp;lt;yinyt@nju.edu.cn&amp;gt;]，计算机系 804 &lt;br /&gt;
:*[https://tcs.nju.edu.cn/shili/ 栗师]：[mailto:shili@nju.edu.cn &amp;lt;shili@nju.edu.cn&amp;gt;]，计算机系 605&lt;br /&gt;
:* [https://liuexp.github.io 刘景铖]：[mailto:liu@nju.edu.cn &amp;lt;liu@nju.edu.cn&amp;gt;]，计算机系 516 &lt;br /&gt;
* &#039;&#039;&#039;Teaching Assistant&#039;&#039;&#039;: &lt;br /&gt;
** 于逸潇：yixiaoyu@smail.nju.edu.cn&lt;br /&gt;
** 张弈垚：zhangyiyao@smail.nju.edu.cn&lt;br /&gt;
* &#039;&#039;&#039;Class meeting&#039;&#039;&#039;: &lt;br /&gt;
** Monday (单), 4pm-6pm, 仙Ⅰ-206&lt;br /&gt;
** Thursday, 2pm-4pm, 仙Ⅰ-206&lt;br /&gt;
* &#039;&#039;&#039;Office hour&#039;&#039;&#039;: Monday, 2pm-4pm, 计算机系 804&lt;br /&gt;
* &#039;&#039;&#039;QQ群&#039;&#039;&#039;: 757436140&lt;br /&gt;
&lt;br /&gt;
= Syllabus =&lt;br /&gt;
随着计算机算法理论的不断发展，现代计算机算法的设计与分析大量地使用非初等的数学工具以及非传统的算法思想。“高级算法”这门课程就是面向计算机算法的这一发展趋势而设立的。课程将针对传统算法课程未系统涉及、却在计算机科学各领域的科研和实践中扮演重要角色的高等算法设计思想和算法分析工具进行系统讲授。&lt;br /&gt;
&lt;br /&gt;
=== 先修课程 Prerequisites ===&lt;br /&gt;
* 必须：离散数学，概率论，线性代数。&lt;br /&gt;
* 推荐：算法设计与分析。&lt;br /&gt;
&lt;br /&gt;
=== Course materials ===&lt;br /&gt;
* [[高级算法 (Fall 2024) / Course materials|&amp;lt;font size=3&amp;gt;教材和参考书&amp;lt;/font&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
=== 成绩 Grades ===&lt;br /&gt;
* 课程成绩：本课程将会有若干次作业和一次期末考试。最终成绩将由平时作业成绩和期末考试成绩综合得出。&lt;br /&gt;
* 迟交：如果有特殊的理由，无法按时完成作业，请提前联系授课老师，给出正当理由。否则迟交的作业将不被接受。&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font color=red&amp;gt; 学术诚信 Academic Integrity &amp;lt;/font&amp;gt;===&lt;br /&gt;
学术诚信是所有从事学术活动的学生和学者最基本的职业道德底线，本课程将不遗余力的维护学术诚信规范，违反这一底线的行为将不会被容忍。&lt;br /&gt;
&lt;br /&gt;
作业完成的原则：署你名字的工作必须是你个人的贡献。在完成作业的过程中，允许讨论，前提是讨论的所有参与者均处于同等完成度。但关键想法的执行、以及作业文本的写作必须独立完成，并在作业中致谢（acknowledge）所有参与讨论的人。不允许其他任何形式的合作——尤其是与已经完成作业的同学“讨论”。&lt;br /&gt;
&lt;br /&gt;
本课程将对剽窃行为采取零容忍的态度。在完成作业过程中，对他人工作（出版物、互联网资料、其他人的作业等）直接的文本抄袭和对关键思想、关键元素的抄袭，按照 [http://www.acm.org/publications/policies/plagiarism_policy ACM Policy on Plagiarism]的解释，都将视为剽窃。剽窃者成绩将被取消。如果发现互相抄袭行为，&amp;lt;font color=red&amp;gt; 抄袭和被抄袭双方的成绩都将被取消&amp;lt;/font&amp;gt;。因此请主动防止自己的作业被他人抄袭。&lt;br /&gt;
&lt;br /&gt;
学术诚信影响学生个人的品行，也关乎整个教育系统的正常运转。为了一点分数而做出学术不端的行为，不仅使自己沦为一个欺骗者，也使他人的诚实努力失去意义。让我们一起努力维护一个诚信的环境。&lt;br /&gt;
&lt;br /&gt;
= Assignments =&lt;br /&gt;
* TBA&lt;br /&gt;
&lt;br /&gt;
= Lecture Notes =&lt;br /&gt;
# [[高级算法 (Fall 2024)/Min Cut, Max Cut, and Spectral Cut|Min Cut, Max Cut, and Spectral Cut]] ([http://tcs.nju.edu.cn/slides/aa2024/Cut.pdf slides])&lt;br /&gt;
#*  [[高级算法 (Fall 2024)/Probability Basics|Probability basics]]&lt;br /&gt;
&lt;br /&gt;
= Related Online Courses=&lt;br /&gt;
* [https://www.cs.cmu.edu/~15850/ Advanced Algorithms] by Anupam Gupta at CMU.&lt;br /&gt;
* [http://people.csail.mit.edu/moitra/854.html Advanced Algorithms] by Ankur Moitra at MIT.&lt;br /&gt;
* [http://courses.csail.mit.edu/6.854/current/ Advanced Algorithms] by David Karger and Aleksander Mądry at MIT.&lt;br /&gt;
* [http://web.stanford.edu/class/cs168/index.html The Modern Algorithmic Toolbox] by Tim Roughgarden and Gregory Valiant at Stanford.&lt;br /&gt;
* [https://www.cs.princeton.edu/courses/archive/fall18/cos521/ Advanced Algorithm Design] by Pravesh Kothari and Christopher Musco at Princeton.&lt;br /&gt;
* [http://www.cs.cmu.edu/afs/cs.cmu.edu/academic/class/15859-f11/www/ Linear and Semidefinite Programming (Advanced Algorithms)] by Anupam Gupta and Ryan O&#039;Donnell at CMU.&lt;br /&gt;
* [https://www.cs.cmu.edu/~odonnell/papers/cs-theory-toolkit-lecture-notes.pdf CS Theory Toolkit] by Ryan O&#039;Donnell at CMU.&lt;br /&gt;
* [https://cs.uwaterloo.ca/~lapchi/cs860/index.html Eigenvalues and Polynomials] by Lap Chi Lau at University of Waterloo.&lt;br /&gt;
* The [https://www.cs.cornell.edu/jeh/book.pdf &amp;quot;Foundations of Data Science&amp;quot; book] by Avrim Blum, John Hopcroft, and Ravindran Kannan.&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=%E8%AE%A1%E7%AE%97%E6%96%B9%E6%B3%95_Numerical_method_(Spring_2024)/Homework7_%E6%8F%90%E4%BA%A4%E5%90%8D%E5%8D%95&amp;diff=12519</id>
		<title>计算方法 Numerical method (Spring 2024)/Homework7 提交名单</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=%E8%AE%A1%E7%AE%97%E6%96%B9%E6%B3%95_Numerical_method_(Spring_2024)/Homework7_%E6%8F%90%E4%BA%A4%E5%90%8D%E5%8D%95&amp;diff=12519"/>
		<updated>2024-06-12T02:34:07Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: Created page with &amp;quot; 如有错漏请邮件联系助教. &amp;lt;center&amp;gt; {| class=&amp;quot;wikitable&amp;quot; |- ! 学号 !! 姓名 |- | 191240047 || 孙宇飞  |- | 201240036 || 钱儒凡  |- | 201240090 || 陈诺星  |- | 211240013 || 李昀芃  |- | 211240020 || 朱睿骐  |- | 211240035 || 王祉天  |- | 211294003 || 倪昀  |- | 221180133 || 黄可唯  |- | 221220002 || 沈均文  |- | 221220003 || 林涵坤  |- | 221220005 || 刘稼新  |- | 221220019 || 洪观澜  |- | 221220027 || 蒋宇阳  |- | 22122002...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; 如有错漏请邮件联系助教.&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 学号 !! 姓名&lt;br /&gt;
|-&lt;br /&gt;
| 191240047 || 孙宇飞 &lt;br /&gt;
|-&lt;br /&gt;
| 201240036 || 钱儒凡 &lt;br /&gt;
|-&lt;br /&gt;
| 201240090 || 陈诺星 &lt;br /&gt;
|-&lt;br /&gt;
| 211240013 || 李昀芃 &lt;br /&gt;
|-&lt;br /&gt;
| 211240020 || 朱睿骐 &lt;br /&gt;
|-&lt;br /&gt;
| 211240035 || 王祉天 &lt;br /&gt;
|-&lt;br /&gt;
| 211294003 || 倪昀 &lt;br /&gt;
|-&lt;br /&gt;
| 221180133 || 黄可唯 &lt;br /&gt;
|-&lt;br /&gt;
| 221220002 || 沈均文 &lt;br /&gt;
|-&lt;br /&gt;
| 221220003 || 林涵坤 &lt;br /&gt;
|-&lt;br /&gt;
| 221220005 || 刘稼新 &lt;br /&gt;
|-&lt;br /&gt;
| 221220019 || 洪观澜 &lt;br /&gt;
|-&lt;br /&gt;
| 221220027 || 蒋宇阳 &lt;br /&gt;
|-&lt;br /&gt;
| 221220029 || 陈俊翰 &lt;br /&gt;
|-&lt;br /&gt;
| 221220033 || 孙一鸣 &lt;br /&gt;
|-&lt;br /&gt;
| 221220034 || 王旭 &lt;br /&gt;
|-&lt;br /&gt;
| 221220035 || 朱一宝 &lt;br /&gt;
|-&lt;br /&gt;
| 221220054 || 董旭 &lt;br /&gt;
|-&lt;br /&gt;
| 221220067 || 刘思远 &lt;br /&gt;
|-&lt;br /&gt;
| 221220073 || 任卫洪 &lt;br /&gt;
|-&lt;br /&gt;
| 221220076 || 落华栋 &lt;br /&gt;
|-&lt;br /&gt;
| 221220092 || 谷莘 &lt;br /&gt;
|-&lt;br /&gt;
| 221220118 || 但佳霖 &lt;br /&gt;
|-&lt;br /&gt;
| 221220125 || 饶博文 &lt;br /&gt;
|-&lt;br /&gt;
| 221220142 || 欧阳瑞泽 &lt;br /&gt;
|-&lt;br /&gt;
| 221220151 || 侯君瑜 &lt;br /&gt;
|-&lt;br /&gt;
| 221220156 || 陈伯昆 &lt;br /&gt;
|-&lt;br /&gt;
| 221220158 || 颜伟坤 &lt;br /&gt;
|-&lt;br /&gt;
| 221240001 || 王炳旭 &lt;br /&gt;
|-&lt;br /&gt;
| 221240008 || 胡佳昕 &lt;br /&gt;
|-&lt;br /&gt;
| 221240022 || 韩瑞 &lt;br /&gt;
|-&lt;br /&gt;
| 221240023 || 蒋耀瑾 &lt;br /&gt;
|-&lt;br /&gt;
| 221240024 || 唐之尧 &lt;br /&gt;
|-&lt;br /&gt;
| 221240026 || 刘俨东 &lt;br /&gt;
|-&lt;br /&gt;
| 221240027 || 唐诗博 &lt;br /&gt;
|-&lt;br /&gt;
| 221240032 || 蔡坤志 &lt;br /&gt;
|-&lt;br /&gt;
| 221240035 || 李想 &lt;br /&gt;
|-&lt;br /&gt;
| 221240041 || 周越洋 &lt;br /&gt;
|-&lt;br /&gt;
| 221240047 || 孙梓洋 &lt;br /&gt;
|-&lt;br /&gt;
| 221240066 || 张植翔 &lt;br /&gt;
|-&lt;br /&gt;
| 221240074 || 曹任飞 &lt;br /&gt;
|-&lt;br /&gt;
| 221240089 || 杨周宇霄 &lt;br /&gt;
|-&lt;br /&gt;
| 221240092 || 杨煜申 &lt;br /&gt;
|-&lt;br /&gt;
| 221240093 || 陈力峥 &lt;br /&gt;
|-&lt;br /&gt;
| 221502001 || 赵子轩 &lt;br /&gt;
|-&lt;br /&gt;
| 221502004 || 李梓荣 &lt;br /&gt;
|-&lt;br /&gt;
| 221502005 || 王昕浩 &lt;br /&gt;
|-&lt;br /&gt;
| 221502006 || 张文权 &lt;br /&gt;
|-&lt;br /&gt;
| 221502008 || 梁今为 &lt;br /&gt;
|-&lt;br /&gt;
| 221502009 || 李嘉洲 &lt;br /&gt;
|-&lt;br /&gt;
| 221502010 || 梁志浩 &lt;br /&gt;
|-&lt;br /&gt;
| 221502014 || 施翔 &lt;br /&gt;
|-&lt;br /&gt;
| 221502017 || 卢君和 &lt;br /&gt;
|-&lt;br /&gt;
| 221502018 || 陈正道 &lt;br /&gt;
|-&lt;br /&gt;
| 221502020 || 李维岩 &lt;br /&gt;
|-&lt;br /&gt;
| 221502024 || 杨栋凯 &lt;br /&gt;
|-&lt;br /&gt;
| 221502025 || 宋相廷 &lt;br /&gt;
|-&lt;br /&gt;
| 221830206 || 李君羡 &lt;br /&gt;
|-&lt;br /&gt;
| 221840201 || 钟锦立 &lt;br /&gt;
|-&lt;br /&gt;
| 221840223 || 王逸飞 &lt;br /&gt;
|-&lt;br /&gt;
| 221840262 || 孙纯洁 &lt;br /&gt;
|-&lt;br /&gt;
| 221840315 || 凌枫 &lt;br /&gt;
|-&lt;br /&gt;
| 221850025 || 高维康 &lt;br /&gt;
|-&lt;br /&gt;
| 221870199 || 黄一凡 &lt;br /&gt;
|-&lt;br /&gt;
| 221870222 || 刘烨 &lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
共 65 人&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=%E8%AE%A1%E7%AE%97%E6%96%B9%E6%B3%95_Numerical_method_(Spring_2024)&amp;diff=12518</id>
		<title>计算方法 Numerical method (Spring 2024)</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=%E8%AE%A1%E7%AE%97%E6%96%B9%E6%B3%95_Numerical_method_(Spring_2024)&amp;diff=12518"/>
		<updated>2024-06-12T02:33:42Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: /* Assignments */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox&lt;br /&gt;
|name         = Infobox&lt;br /&gt;
|bodystyle    = &lt;br /&gt;
|title        = &amp;lt;font size=3&amp;gt;计算方法&lt;br /&gt;
&amp;lt;br&amp;gt;Numerical method&amp;lt;/font&amp;gt;&lt;br /&gt;
|titlestyle   = &lt;br /&gt;
&lt;br /&gt;
|image        = &lt;br /&gt;
|imagestyle   = &lt;br /&gt;
|caption      = &lt;br /&gt;
|captionstyle = &lt;br /&gt;
|headerstyle  = background:#ccf;&lt;br /&gt;
|labelstyle   = background:#ddf;&lt;br /&gt;
|datastyle    = &lt;br /&gt;
&lt;br /&gt;
|header1 =Instructor&lt;br /&gt;
|label1  = &lt;br /&gt;
|data1   = &lt;br /&gt;
|header2 = &lt;br /&gt;
|label2  = &lt;br /&gt;
|data2   = 刘景铖&lt;br /&gt;
|header3 = &lt;br /&gt;
|label3  = Email&lt;br /&gt;
|data3   = liu [at] nju [dot] edu [dot] cn  &lt;br /&gt;
|header4 =&lt;br /&gt;
|label4= Office&lt;br /&gt;
|data4= 计算机系 516&lt;br /&gt;
|header5 = Class&lt;br /&gt;
|label5  = &lt;br /&gt;
|data5   = &lt;br /&gt;
|header6 =&lt;br /&gt;
|label6  = Class meetings&lt;br /&gt;
|data6   = 周三 14:00-16:00 &amp;lt;br&amp;gt; 仙 Ⅱ-303&lt;br /&gt;
|header7 =&lt;br /&gt;
|label7  = Place&lt;br /&gt;
|data7   = &lt;br /&gt;
|header8 =&lt;br /&gt;
|label8  = &lt;br /&gt;
|data8   = &lt;br /&gt;
|header9 = Textbooks&lt;br /&gt;
|label9  = &lt;br /&gt;
|data9   = &lt;br /&gt;
|header10 =&lt;br /&gt;
|label10  = &lt;br /&gt;
|data10   = &lt;br /&gt;
|header11 =&lt;br /&gt;
|label11  = &lt;br /&gt;
|data11   =  Timothy Sauer &amp;lt;br&amp;gt;数值分析 （Numerical Analysis）（原书第2版）.&amp;lt;br&amp;gt; 机械工业出版社.&lt;br /&gt;
|header12 = Teaching Assistants&lt;br /&gt;
|data13= 傅心语，于逸潇&lt;br /&gt;
|label14= Email&lt;br /&gt;
|data14=  {xyfu, yixiaoyu} [at] smail [dot] nju [dot] edu [dot] cn&lt;br /&gt;
|label15= Office&lt;br /&gt;
|data15=计算机系 410&lt;br /&gt;
|belowstyle = background:#ddf;&lt;br /&gt;
|below = &lt;br /&gt;
}}&lt;br /&gt;
=Announcement=&lt;br /&gt;
*Welcome&lt;br /&gt;
=Course info=&lt;br /&gt;
*&#039;&#039;&#039;Instructor&#039;&#039;&#039;: 刘景铖 ( liu [at] nju [dot] edu [dot] cn )&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Teaching assistants&#039;&#039;&#039;: 傅心语，于逸潇&lt;br /&gt;
*&#039;&#039;&#039;TA email&#039;&#039;&#039;: {xyfu, yixiaoyu} [at] smail [dot] nju [dot] edu [dot] cn&lt;br /&gt;
*&#039;&#039;&#039;Homework email&#039;&#039;&#039;: nm_nju_2024@163.com&lt;br /&gt;
*&#039;&#039;&#039;Class meeting&#039;&#039;&#039;:周三 14:00-16:00， 仙 Ⅱ-303&lt;br /&gt;
*&#039;&#039;&#039;Office hour&#039;&#039;&#039;: 周二 16:00-18:00?, 计算机系516 (subject to change)&lt;br /&gt;
*&#039;&#039;&#039;QQ群&#039;&#039;&#039;: 855212527.(加入时需报姓名、专业、学号)&lt;br /&gt;
&lt;br /&gt;
=Textbooks and Readings=&lt;br /&gt;
*数值分析 （Numerical Analysis）（原书第2版）. Timothy Sauer.   机械工业出版社.&lt;br /&gt;
*[https://people.csail.mit.edu/jsolomon/share/book/numerical_book.pdf Numerical Algorithms: Methods for Computer Vision, Machine Learning, and Graphics.  Justin Solomon. CRC Press]&lt;br /&gt;
*[https://www.cs.yale.edu/homes/vishnoi/Lxb-Web.pdf Lx=b, Laplacian Solver and Their Algorithmic Applications.  Nisheeth K. Vishnoi.]&lt;br /&gt;
如果在获取教材方面有困难可以联系助教。(仅限英文版)&lt;br /&gt;
&lt;br /&gt;
= Collaboration on Homework =&lt;br /&gt;
You are welcome to work on homework problems in study groups of no more than 3 people; however, you must always write up the solutions on your own, listing all collaborators at the top. Similarly, you may use books or online resources to help solve homework problems, but you must always credit all such sources in your writeup and you must never copy material verbatim.&lt;br /&gt;
&lt;br /&gt;
We believe that most students can distinguish between helping other students and cheating. You may discuss approaches but your solution must be written by you and you only. You should acknowledge everyone whom you have worked with or who has given you any significant ideas about the homework.&lt;br /&gt;
&lt;br /&gt;
Further, it is your responsibility to ensure that your solutions will not be visible to other students. If you use Github or another source control system to store your solutions electronically, you must ensure your account is configured so your solutions are not publicly visible. Many popular version control systems provide free repositories to students.&lt;br /&gt;
&lt;br /&gt;
As a final note, we’d like to point out that collaboration on homework, while permitted, can be detrimental to your learning if misused. In particular, avoid collaborations where you do not contribute enough to your own satisfaction. Such a collaboration not only cheats you out of an opportunity to learn through homework, but can also affect your confidence. If you feel that you are not contributing enough to your group, then try to spend time thinking about the problems alone before working with your group. If you end up solving the problem all by yourself, that’s great! And if not, you’ll still be better prepared to contribute to your group.&lt;br /&gt;
&lt;br /&gt;
See also [http://www.acm.org/publications/policies/plagiarism_policy ACM Policy on Plagiarism].&lt;br /&gt;
&lt;br /&gt;
=Assignments=&lt;br /&gt;
Late policy: In general, we will accomodate late submission requests ONLY IF you made such requests ahead of time. &lt;br /&gt;
&lt;br /&gt;
# [[Media:Computational Method 2024 Assignments1 new.pdf| Homework1]] 请在 2024年03月12日23点59分之前提交到 nm_nju_2024@163.com  (文件名为&#039;学号_姓名_A1.pdf&#039;) [[计算方法 Numerical method (Spring 2024)/Homework1 提交名单| Homework1 提交名单]]&lt;br /&gt;
#[[Media:Computational Method 2024 Assignments 2.pdf| Homework2]] 请在 2024年03月26日23点59分之前提交到 nm_nju_2024@163.com  (文件名为&#039;学号_姓名_A2.pdf&#039;) [[计算方法 Numerical method (Spring 2024)/Homework2 提交名单| Homework2 提交名单]]&lt;br /&gt;
#[[Media:Computational Method 2024 Assignments 3.pdf| Homework3]] 请在 2024年04月09日23点59分之前提交到 nm_nju_2024@163.com  (文件名为&#039;学号_姓名_A3.pdf&#039;) [[计算方法 Numerical method (Spring 2024)/Homework3 提交名单| Homework3 提交名单]]&lt;br /&gt;
#[[Media:Computational Method 2024 Assignments4.pdf| Homework4]] 请在 2024年05月01日23点59分之前提交到 nm_nju_2024@163.com  (文件名为&#039;学号_姓名_A4.pdf&#039;) [[计算方法 Numerical method (Spring 2024)/Homework4 提交名单| Homework4 提交名单]]&lt;br /&gt;
#[[Media:Computational Method 2024 Assignments 5.pdf| Homework5]] 请在 2024年05月14日23点59分之前提交到 nm_nju_2024@163.com  (文件名为&#039;学号_姓名_A5.pdf&#039;) [[计算方法 Numerical method (Spring 2024)/Homework5 提交名单| Homework5 提交名单]]&lt;br /&gt;
#[[Media:Computational Method 2024 Assignments 6.pdf| Homework6]] 请在 2024年05月28日23点59分之前提交到 nm_nju_2024@163.com  (文件名为&#039;学号_姓名_A6.pdf&#039;) [[计算方法 Numerical method (Spring 2024)/Homework6 提交名单| Homework6 提交名单]]&lt;br /&gt;
#[[Media:Computational Method 2024 Assignments 7.pdf| Homework7]] 请在 2024年06月11日23点59分之前提交到 nm_nju_2024@163.com  (文件名为&#039;学号_姓名_A7.pdf&#039;) [[计算方法 Numerical method (Spring 2024)/Homework7 提交名单| Homework7 提交名单]]&lt;br /&gt;
&lt;br /&gt;
=Lecture Notes=&lt;br /&gt;
如果有下载课件的问题请及时联系助教。&lt;br /&gt;
	&lt;br /&gt;
# [[Media:计算方法1-课程简介-Spring2024.pdf| 课程简介，函数求根]]&lt;br /&gt;
# [[Media:计算方法2-插值-Spring2024.pdf| 牛顿法，插值，秘密分享，自纠错码]]&lt;br /&gt;
# [[Media:计算方法3-Chebyshev-Spring2024.pdf| Chebyshev插值与多项式，范数]]&lt;br /&gt;
# [[Media:计算方法4-最小二乘法.pdf|最小二乘法，Gram-Schmidt正交化与QR分解]]&lt;br /&gt;
# [[Media:计算方法5-高斯消元.pdf|FFT，高斯消元与LU分解]]&lt;br /&gt;
# [[Media:计算方法6-条件数和迭代法.pdf|算子范数，条件数和迭代法]]&lt;br /&gt;
# [[Media:计算方法 7-特征值与幂迭代.pdf|特征值与幂迭代]]&lt;br /&gt;
# [[Media:计算方法 8-特征值的其它迭代方法与SVD.pdf|特征值的其它迭代方法与SVD]]&lt;br /&gt;
#* Further reading: [https://web.stanford.edu/class/cs168/l/l9.pdf lecture note by Tim Roughgarden and Greg Valiant on matrix completions]&lt;br /&gt;
# [[Media:计算方法9-ConjugateGradient.pdf | 迭代法解线性方程组：梯度下降方法与共轭梯度]]&lt;br /&gt;
# [[Media:计算方法10-2024.pdf | 幂迭代的特例：随机游走与马尔可夫链]]&lt;br /&gt;
# [[Media:计算方法11-谱图论-2024.pdf |谱图论]]&lt;br /&gt;
# [[Media:计算方法12-电阻电路网络-2024.pdf |电阻电路网络]]&lt;br /&gt;
# [[Media:计算方法13-hitting time and LP-2024.pdf|碰撞时间、遍历时间和线性规划入门]]&lt;br /&gt;
# [[Media:计算方法14-duality-2024.pdf|对偶性原理与应用]]&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=%E8%AE%A1%E7%AE%97%E6%96%B9%E6%B3%95_Numerical_method_(Spring_2024)/Homework6_%E6%8F%90%E4%BA%A4%E5%90%8D%E5%8D%95&amp;diff=12474</id>
		<title>计算方法 Numerical method (Spring 2024)/Homework6 提交名单</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=%E8%AE%A1%E7%AE%97%E6%96%B9%E6%B3%95_Numerical_method_(Spring_2024)/Homework6_%E6%8F%90%E4%BA%A4%E5%90%8D%E5%8D%95&amp;diff=12474"/>
		<updated>2024-05-29T06:18:04Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: Created page with &amp;quot; 如有错漏请邮件联系助教. &amp;lt;center&amp;gt; {| class=&amp;quot;wikitable&amp;quot; |- ! 学号 !! 姓名 |- | 191240047 || 孙宇飞  |- | 201240036 || 钱儒凡  |- | 201240090 || 陈诺星  |- | 211240013 || 李昀芃  |- | 211240020 || 朱睿骐  |- | 211240035 || 王祉天  |- | 211294003 || 倪昀  |- | 221180133 || 黄可唯  |- | 221220002 || 沈均文  |- | 221220003 || 林涵坤  |- | 221220019 || 洪观澜  |- | 221220027 || 蒋宇阳  |- | 221220029 || 陈俊翰  |- | 22122003...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; 如有错漏请邮件联系助教.&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 学号 !! 姓名&lt;br /&gt;
|-&lt;br /&gt;
| 191240047 || 孙宇飞 &lt;br /&gt;
|-&lt;br /&gt;
| 201240036 || 钱儒凡 &lt;br /&gt;
|-&lt;br /&gt;
| 201240090 || 陈诺星 &lt;br /&gt;
|-&lt;br /&gt;
| 211240013 || 李昀芃 &lt;br /&gt;
|-&lt;br /&gt;
| 211240020 || 朱睿骐 &lt;br /&gt;
|-&lt;br /&gt;
| 211240035 || 王祉天 &lt;br /&gt;
|-&lt;br /&gt;
| 211294003 || 倪昀 &lt;br /&gt;
|-&lt;br /&gt;
| 221180133 || 黄可唯 &lt;br /&gt;
|-&lt;br /&gt;
| 221220002 || 沈均文 &lt;br /&gt;
|-&lt;br /&gt;
| 221220003 || 林涵坤 &lt;br /&gt;
|-&lt;br /&gt;
| 221220019 || 洪观澜 &lt;br /&gt;
|-&lt;br /&gt;
| 221220027 || 蒋宇阳 &lt;br /&gt;
|-&lt;br /&gt;
| 221220029 || 陈俊翰 &lt;br /&gt;
|-&lt;br /&gt;
| 221220033 || 孙一鸣 &lt;br /&gt;
|-&lt;br /&gt;
| 221220034 || 王旭 &lt;br /&gt;
|-&lt;br /&gt;
| 221220035 || 朱一宝 &lt;br /&gt;
|-&lt;br /&gt;
| 221220067 || 刘思远 &lt;br /&gt;
|-&lt;br /&gt;
| 221220073 || 任卫洪 &lt;br /&gt;
|-&lt;br /&gt;
| 221220076 || 落华栋 &lt;br /&gt;
|-&lt;br /&gt;
| 221220092 || 谷莘 &lt;br /&gt;
|-&lt;br /&gt;
| 221220095 || 曾凡俊 &lt;br /&gt;
|-&lt;br /&gt;
| 221220106 || 黄伟贤 &lt;br /&gt;
|-&lt;br /&gt;
| 221220118 || 但佳霖 &lt;br /&gt;
|-&lt;br /&gt;
| 221220125 || 饶博文 &lt;br /&gt;
|-&lt;br /&gt;
| 221220142 || 欧阳瑞泽 &lt;br /&gt;
|-&lt;br /&gt;
| 221220151 || 侯君瑜 &lt;br /&gt;
|-&lt;br /&gt;
| 221220156 || 陈伯昆 &lt;br /&gt;
|-&lt;br /&gt;
| 221220158 || 颜伟坤 &lt;br /&gt;
|-&lt;br /&gt;
| 221240001 || 王炳旭 &lt;br /&gt;
|-&lt;br /&gt;
| 221240008 || 胡佳昕 &lt;br /&gt;
|-&lt;br /&gt;
| 221240022 || 韩瑞 &lt;br /&gt;
|-&lt;br /&gt;
| 221240023 || 蒋耀瑾 &lt;br /&gt;
|-&lt;br /&gt;
| 221240024 || 唐之尧 &lt;br /&gt;
|-&lt;br /&gt;
| 221240026 || 刘俨东 &lt;br /&gt;
|-&lt;br /&gt;
| 221240027 || 唐诗博 &lt;br /&gt;
|-&lt;br /&gt;
| 221240032 || 蔡坤志 &lt;br /&gt;
|-&lt;br /&gt;
| 221240035 || 李想 &lt;br /&gt;
|-&lt;br /&gt;
| 221240041 || 周越洋 &lt;br /&gt;
|-&lt;br /&gt;
| 221240047 || 孙梓洋 &lt;br /&gt;
|-&lt;br /&gt;
| 221240066 || 张植翔 &lt;br /&gt;
|-&lt;br /&gt;
| 221240074 || 曹任飞 &lt;br /&gt;
|-&lt;br /&gt;
| 221240089 || 杨周宇霄 &lt;br /&gt;
|-&lt;br /&gt;
| 221240092 || 杨煜申 &lt;br /&gt;
|-&lt;br /&gt;
| 221240093 || 陈力峥 &lt;br /&gt;
|-&lt;br /&gt;
| 221502001 || 赵子轩 &lt;br /&gt;
|-&lt;br /&gt;
| 221502004 || 李梓荣 &lt;br /&gt;
|-&lt;br /&gt;
| 221502005 || 王昕浩 &lt;br /&gt;
|-&lt;br /&gt;
| 221502006 || 张文权 &lt;br /&gt;
|-&lt;br /&gt;
| 221502009 || 李嘉洲 &lt;br /&gt;
|-&lt;br /&gt;
| 221502010 || 梁志浩 &lt;br /&gt;
|-&lt;br /&gt;
| 221502014 || 施翔 &lt;br /&gt;
|-&lt;br /&gt;
| 221502015 || 王天宇 &lt;br /&gt;
|-&lt;br /&gt;
| 221502017 || 卢君和 &lt;br /&gt;
|-&lt;br /&gt;
| 221502018 || 陈正道 &lt;br /&gt;
|-&lt;br /&gt;
| 221502020 || 李维岩 &lt;br /&gt;
|-&lt;br /&gt;
| 221502025 || 宋相廷 &lt;br /&gt;
|-&lt;br /&gt;
| 221830012 || 茆弘之 &lt;br /&gt;
|-&lt;br /&gt;
| 221830206 || 李君羡 &lt;br /&gt;
|-&lt;br /&gt;
| 221840201 || 钟锦立 &lt;br /&gt;
|-&lt;br /&gt;
| 221840223 || 王逸飞 &lt;br /&gt;
|-&lt;br /&gt;
| 221840262 || 孙纯洁 &lt;br /&gt;
|-&lt;br /&gt;
| 221840315 || 凌枫 &lt;br /&gt;
|-&lt;br /&gt;
| 221850025 || 高维康 &lt;br /&gt;
|-&lt;br /&gt;
| 221870052 || 吴隽雨 &lt;br /&gt;
|-&lt;br /&gt;
| 221870199 || 黄一凡 &lt;br /&gt;
|-&lt;br /&gt;
| 221870222 || 刘烨 &lt;br /&gt;
|-&lt;br /&gt;
| 225102007 || 崔毓泽 &lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
共 67 人&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=%E8%AE%A1%E7%AE%97%E6%96%B9%E6%B3%95_Numerical_method_(Spring_2024)&amp;diff=12473</id>
		<title>计算方法 Numerical method (Spring 2024)</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=%E8%AE%A1%E7%AE%97%E6%96%B9%E6%B3%95_Numerical_method_(Spring_2024)&amp;diff=12473"/>
		<updated>2024-05-29T05:59:21Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: /* Assignments */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox&lt;br /&gt;
|name         = Infobox&lt;br /&gt;
|bodystyle    = &lt;br /&gt;
|title        = &amp;lt;font size=3&amp;gt;计算方法&lt;br /&gt;
&amp;lt;br&amp;gt;Numerical method&amp;lt;/font&amp;gt;&lt;br /&gt;
|titlestyle   = &lt;br /&gt;
&lt;br /&gt;
|image        = &lt;br /&gt;
|imagestyle   = &lt;br /&gt;
|caption      = &lt;br /&gt;
|captionstyle = &lt;br /&gt;
|headerstyle  = background:#ccf;&lt;br /&gt;
|labelstyle   = background:#ddf;&lt;br /&gt;
|datastyle    = &lt;br /&gt;
&lt;br /&gt;
|header1 =Instructor&lt;br /&gt;
|label1  = &lt;br /&gt;
|data1   = &lt;br /&gt;
|header2 = &lt;br /&gt;
|label2  = &lt;br /&gt;
|data2   = 刘景铖&lt;br /&gt;
|header3 = &lt;br /&gt;
|label3  = Email&lt;br /&gt;
|data3   = liu [at] nju [dot] edu [dot] cn  &lt;br /&gt;
|header4 =&lt;br /&gt;
|label4= Office&lt;br /&gt;
|data4= 计算机系 516&lt;br /&gt;
|header5 = Class&lt;br /&gt;
|label5  = &lt;br /&gt;
|data5   = &lt;br /&gt;
|header6 =&lt;br /&gt;
|label6  = Class meetings&lt;br /&gt;
|data6   = 周三 14:00-16:00 &amp;lt;br&amp;gt; 仙 Ⅱ-303&lt;br /&gt;
|header7 =&lt;br /&gt;
|label7  = Place&lt;br /&gt;
|data7   = &lt;br /&gt;
|header8 =&lt;br /&gt;
|label8  = &lt;br /&gt;
|data8   = &lt;br /&gt;
|header9 = Textbooks&lt;br /&gt;
|label9  = &lt;br /&gt;
|data9   = &lt;br /&gt;
|header10 =&lt;br /&gt;
|label10  = &lt;br /&gt;
|data10   = &lt;br /&gt;
|header11 =&lt;br /&gt;
|label11  = &lt;br /&gt;
|data11   =  Timothy Sauer &amp;lt;br&amp;gt;数值分析 （Numerical Analysis）（原书第2版）.&amp;lt;br&amp;gt; 机械工业出版社.&lt;br /&gt;
|header12 = Teaching Assistants&lt;br /&gt;
|data13= 傅心语，于逸潇&lt;br /&gt;
|label14= Email&lt;br /&gt;
|data14=  {xyfu, yixiaoyu} [at] smail [dot] nju [dot] edu [dot] cn&lt;br /&gt;
|label15= Office&lt;br /&gt;
|data15=计算机系 410&lt;br /&gt;
|belowstyle = background:#ddf;&lt;br /&gt;
|below = &lt;br /&gt;
}}&lt;br /&gt;
=Announcement=&lt;br /&gt;
*Welcome&lt;br /&gt;
=Course info=&lt;br /&gt;
*&#039;&#039;&#039;Instructor&#039;&#039;&#039;: 刘景铖 ( liu [at] nju [dot] edu [dot] cn )&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Teaching assistants&#039;&#039;&#039;: 傅心语，于逸潇&lt;br /&gt;
*&#039;&#039;&#039;TA email&#039;&#039;&#039;: {xyfu, yixiaoyu} [at] smail [dot] nju [dot] edu [dot] cn&lt;br /&gt;
*&#039;&#039;&#039;Homework email&#039;&#039;&#039;: nm_nju_2024@163.com&lt;br /&gt;
*&#039;&#039;&#039;Class meeting&#039;&#039;&#039;:周三 14:00-16:00， 仙 Ⅱ-303&lt;br /&gt;
*&#039;&#039;&#039;Office hour&#039;&#039;&#039;: 周二 16:00-18:00?, 计算机系516 (subject to change)&lt;br /&gt;
*&#039;&#039;&#039;QQ群&#039;&#039;&#039;: 855212527.(加入时需报姓名、专业、学号)&lt;br /&gt;
&lt;br /&gt;
=Textbooks and Readings=&lt;br /&gt;
*数值分析 （Numerical Analysis）（原书第2版）. Timothy Sauer.   机械工业出版社.&lt;br /&gt;
*[https://people.csail.mit.edu/jsolomon/share/book/numerical_book.pdf Numerical Algorithms: Methods for Computer Vision, Machine Learning, and Graphics.  Justin Solomon. CRC Press]&lt;br /&gt;
*[https://www.cs.yale.edu/homes/vishnoi/Lxb-Web.pdf Lx=b, Laplacian Solver and Their Algorithmic Applications.  Nisheeth K. Vishnoi.]&lt;br /&gt;
如果在获取教材方面有困难可以联系助教。(仅限英文版)&lt;br /&gt;
&lt;br /&gt;
= Collaboration on Homework =&lt;br /&gt;
You are welcome to work on homework problems in study groups of no more than 3 people; however, you must always write up the solutions on your own, listing all collaborators at the top. Similarly, you may use books or online resources to help solve homework problems, but you must always credit all such sources in your writeup and you must never copy material verbatim.&lt;br /&gt;
&lt;br /&gt;
We believe that most students can distinguish between helping other students and cheating. You may discuss approaches but your solution must be written by you and you only. You should acknowledge everyone whom you have worked with or who has given you any significant ideas about the homework.&lt;br /&gt;
&lt;br /&gt;
Further, it is your responsibility to ensure that your solutions will not be visible to other students. If you use Github or another source control system to store your solutions electronically, you must ensure your account is configured so your solutions are not publicly visible. Many popular version control systems provide free repositories to students.&lt;br /&gt;
&lt;br /&gt;
As a final note, we’d like to point out that collaboration on homework, while permitted, can be detrimental to your learning if misused. In particular, avoid collaborations where you do not contribute enough to your own satisfaction. Such a collaboration not only cheats you out of an opportunity to learn through homework, but can also affect your confidence. If you feel that you are not contributing enough to your group, then try to spend time thinking about the problems alone before working with your group. If you end up solving the problem all by yourself, that’s great! And if not, you’ll still be better prepared to contribute to your group.&lt;br /&gt;
&lt;br /&gt;
See also [http://www.acm.org/publications/policies/plagiarism_policy ACM Policy on Plagiarism].&lt;br /&gt;
&lt;br /&gt;
=Assignments=&lt;br /&gt;
Late policy: In general, we will accomodate late submission requests ONLY IF you made such requests ahead of time. &lt;br /&gt;
&lt;br /&gt;
# [[Media:Computational Method 2024 Assignments1 new.pdf| Homework1]] 请在 2024年03月12日23点59分之前提交到 nm_nju_2024@163.com  (文件名为&#039;学号_姓名_A1.pdf&#039;) [[计算方法 Numerical method (Spring 2024)/Homework1 提交名单| Homework1 提交名单]]&lt;br /&gt;
#[[Media:Computational Method 2024 Assignments 2.pdf| Homework2]] 请在 2024年03月26日23点59分之前提交到 nm_nju_2024@163.com  (文件名为&#039;学号_姓名_A2.pdf&#039;) [[计算方法 Numerical method (Spring 2024)/Homework2 提交名单| Homework2 提交名单]]&lt;br /&gt;
#[[Media:Computational Method 2024 Assignments 3.pdf| Homework3]] 请在 2024年04月09日23点59分之前提交到 nm_nju_2024@163.com  (文件名为&#039;学号_姓名_A3.pdf&#039;) [[计算方法 Numerical method (Spring 2024)/Homework3 提交名单| Homework3 提交名单]]&lt;br /&gt;
#[[Media:Computational Method 2024 Assignments4.pdf| Homework4]] 请在 2024年05月01日23点59分之前提交到 nm_nju_2024@163.com  (文件名为&#039;学号_姓名_A4.pdf&#039;) [[计算方法 Numerical method (Spring 2024)/Homework4 提交名单| Homework4 提交名单]]&lt;br /&gt;
#[[Media:Computational Method 2024 Assignments 5.pdf| Homework5]] 请在 2024年05月14日23点59分之前提交到 nm_nju_2024@163.com  (文件名为&#039;学号_姓名_A5.pdf&#039;) [[计算方法 Numerical method (Spring 2024)/Homework5 提交名单| Homework5 提交名单]]&lt;br /&gt;
#[[Media:Computational Method 2024 Assignments 6.pdf| Homework6]] 请在 2024年05月28日23点59分之前提交到 nm_nju_2024@163.com  (文件名为&#039;学号_姓名_A6.pdf&#039;) [[计算方法 Numerical method (Spring 2024)/Homework6 提交名单| Homework6 提交名单]]&lt;br /&gt;
#[[Media:Computational Method 2024 Assignments 7.pdf| Homework7]] 请在 2024年06月11日23点59分之前提交到 nm_nju_2024@163.com  (文件名为&#039;学号_姓名_A7.pdf&#039;)&lt;br /&gt;
&lt;br /&gt;
=Lecture Notes=&lt;br /&gt;
如果有下载课件的问题请及时联系助教。&lt;br /&gt;
	&lt;br /&gt;
# [[Media:计算方法1-课程简介-Spring2024.pdf| 课程简介，函数求根]]&lt;br /&gt;
# [[Media:计算方法2-插值-Spring2024.pdf| 牛顿法，插值，秘密分享，自纠错码]]&lt;br /&gt;
# [[Media:计算方法3-Chebyshev-Spring2024.pdf| Chebyshev插值与多项式，范数]]&lt;br /&gt;
# [[Media:计算方法4-最小二乘法.pdf|最小二乘法，Gram-Schmidt正交化与QR分解]]&lt;br /&gt;
# [[Media:计算方法5-高斯消元.pdf|FFT，高斯消元与LU分解]]&lt;br /&gt;
# [[Media:计算方法6-条件数和迭代法.pdf|算子范数，条件数和迭代法]]&lt;br /&gt;
# [[Media:计算方法 7-特征值与幂迭代.pdf|特征值与幂迭代]]&lt;br /&gt;
# [[Media:计算方法 8-特征值的其它迭代方法与SVD.pdf|特征值的其它迭代方法与SVD]]&lt;br /&gt;
## Further reading: [https://web.stanford.edu/class/cs168/l/l9.pdf lecture note by Tim Roughgarden and Greg Valiant on matrix completions]&lt;br /&gt;
# [[Media:计算方法9-ConjugateGradient.pdf | 迭代法解线性方程组：梯度下降方法与共轭梯度]]&lt;br /&gt;
# [[Media:计算方法10-2024.pdf | 幂迭代的特例：随机游走与马尔可夫链]]&lt;br /&gt;
# [[Media:计算方法11-谱图论-2024.pdf |谱图论]]&lt;br /&gt;
# [[Media:计算方法12-电阻电路网络-2024.pdf |电阻电路网络]]&lt;br /&gt;
# [[Media:计算方法13-hitting time and LP-2024.pdf|碰撞时间、遍历时间和线性规划入门]]&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=File:Computational_Method_2024_Assignments_6.pdf&amp;diff=12459</id>
		<title>File:Computational Method 2024 Assignments 6.pdf</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=File:Computational_Method_2024_Assignments_6.pdf&amp;diff=12459"/>
		<updated>2024-05-26T09:05:59Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: Kvrmnks uploaded a new version of File:Computational Method 2024 Assignments 6.pdf&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=File:Computational_Method_2024_Assignments_6.pdf&amp;diff=12413</id>
		<title>File:Computational Method 2024 Assignments 6.pdf</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=File:Computational_Method_2024_Assignments_6.pdf&amp;diff=12413"/>
		<updated>2024-05-20T14:38:50Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: Kvrmnks uploaded a new version of File:Computational Method 2024 Assignments 6.pdf&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=File:Computational_Method_2024_Assignments_6.pdf&amp;diff=12406</id>
		<title>File:Computational Method 2024 Assignments 6.pdf</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=File:Computational_Method_2024_Assignments_6.pdf&amp;diff=12406"/>
		<updated>2024-05-15T07:07:55Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: Kvrmnks uploaded a new version of File:Computational Method 2024 Assignments 6.pdf&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=%E8%AE%A1%E7%AE%97%E6%96%B9%E6%B3%95_Numerical_method_(Spring_2024)/Homework5_%E6%8F%90%E4%BA%A4%E5%90%8D%E5%8D%95&amp;diff=12399</id>
		<title>计算方法 Numerical method (Spring 2024)/Homework5 提交名单</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=%E8%AE%A1%E7%AE%97%E6%96%B9%E6%B3%95_Numerical_method_(Spring_2024)/Homework5_%E6%8F%90%E4%BA%A4%E5%90%8D%E5%8D%95&amp;diff=12399"/>
		<updated>2024-05-14T16:06:29Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: Created page with &amp;quot; 如有错漏请邮件联系助教. &amp;lt;center&amp;gt; {| class=&amp;quot;wikitable&amp;quot; |- ! 学号 !! 姓名 |- | 191240047 || 孙宇飞  |- | 201240036 || 钱儒凡  |- | 211240013 || 李昀芃  |- | 211240020 || 朱睿骐  |- | 211240035 || 王祉天  |- | 211294003 || 倪昀  |- | 221180133 || 黄可唯  |- | 221220002 || 沈均文  |- | 221220003 || 林涵坤  |- | 221220019 || 洪观澜  |- | 221220027 || 蒋宇阳  |- | 221220029 || 陈俊翰  |- | 221220033 || 孙一鸣  |- | 22122003...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; 如有错漏请邮件联系助教.&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 学号 !! 姓名&lt;br /&gt;
|-&lt;br /&gt;
| 191240047 || 孙宇飞 &lt;br /&gt;
|-&lt;br /&gt;
| 201240036 || 钱儒凡 &lt;br /&gt;
|-&lt;br /&gt;
| 211240013 || 李昀芃 &lt;br /&gt;
|-&lt;br /&gt;
| 211240020 || 朱睿骐 &lt;br /&gt;
|-&lt;br /&gt;
| 211240035 || 王祉天 &lt;br /&gt;
|-&lt;br /&gt;
| 211294003 || 倪昀 &lt;br /&gt;
|-&lt;br /&gt;
| 221180133 || 黄可唯 &lt;br /&gt;
|-&lt;br /&gt;
| 221220002 || 沈均文 &lt;br /&gt;
|-&lt;br /&gt;
| 221220003 || 林涵坤 &lt;br /&gt;
|-&lt;br /&gt;
| 221220019 || 洪观澜 &lt;br /&gt;
|-&lt;br /&gt;
| 221220027 || 蒋宇阳 &lt;br /&gt;
|-&lt;br /&gt;
| 221220029 || 陈俊翰 &lt;br /&gt;
|-&lt;br /&gt;
| 221220033 || 孙一鸣 &lt;br /&gt;
|-&lt;br /&gt;
| 221220034 || 王旭 &lt;br /&gt;
|-&lt;br /&gt;
| 221220035 || 朱一宝 &lt;br /&gt;
|-&lt;br /&gt;
| 221220054 || 董旭 &lt;br /&gt;
|-&lt;br /&gt;
| 221220067 || 刘思远 &lt;br /&gt;
|-&lt;br /&gt;
| 221220073 || 任卫洪 &lt;br /&gt;
|-&lt;br /&gt;
| 221220076 || 落华栋 &lt;br /&gt;
|-&lt;br /&gt;
| 221220092 || 谷莘 &lt;br /&gt;
|-&lt;br /&gt;
| 221220095 || 曾凡俊 &lt;br /&gt;
|-&lt;br /&gt;
| 221220106 || 黄伟贤 &lt;br /&gt;
|-&lt;br /&gt;
| 221220118 || 但佳霖 &lt;br /&gt;
|-&lt;br /&gt;
| 221220125 || 饶博文 &lt;br /&gt;
|-&lt;br /&gt;
| 221220142 || 欧阳瑞泽 &lt;br /&gt;
|-&lt;br /&gt;
| 221220151 || 侯君瑜 &lt;br /&gt;
|-&lt;br /&gt;
| 221220156 || 陈伯昆 &lt;br /&gt;
|-&lt;br /&gt;
| 221220158 || 颜伟坤 &lt;br /&gt;
|-&lt;br /&gt;
| 221240001 || 王炳旭 &lt;br /&gt;
|-&lt;br /&gt;
| 221240008 || 胡佳昕 &lt;br /&gt;
|-&lt;br /&gt;
| 221240022 || 韩瑞 &lt;br /&gt;
|-&lt;br /&gt;
| 221240023 || 蒋耀瑾 &lt;br /&gt;
|-&lt;br /&gt;
| 221240024 || 唐之尧 &lt;br /&gt;
|-&lt;br /&gt;
| 221240026 || 刘俨东 &lt;br /&gt;
|-&lt;br /&gt;
| 221240027 || 唐诗博 &lt;br /&gt;
|-&lt;br /&gt;
| 221240032 || 蔡坤志 &lt;br /&gt;
|-&lt;br /&gt;
| 221240035 || 李想 &lt;br /&gt;
|-&lt;br /&gt;
| 221240041 || 周越洋 &lt;br /&gt;
|-&lt;br /&gt;
| 221240043 || 袁汉峙 &lt;br /&gt;
|-&lt;br /&gt;
| 221240047 || 孙梓洋 &lt;br /&gt;
|-&lt;br /&gt;
| 221240066 || 张植翔 &lt;br /&gt;
|-&lt;br /&gt;
| 221240074 || 曹任飞 &lt;br /&gt;
|-&lt;br /&gt;
| 221240089 || 杨周宇霄 &lt;br /&gt;
|-&lt;br /&gt;
| 221240092 || 杨煜申 &lt;br /&gt;
|-&lt;br /&gt;
| 221240093 || 陈力峥 &lt;br /&gt;
|-&lt;br /&gt;
| 221502001 || 赵子轩 &lt;br /&gt;
|-&lt;br /&gt;
| 221502004 || 李梓荣 &lt;br /&gt;
|-&lt;br /&gt;
| 221502005 || 王昕浩 &lt;br /&gt;
|-&lt;br /&gt;
| 221502006 || 张文权 &lt;br /&gt;
|-&lt;br /&gt;
| 221502007 || 崔毓泽 &lt;br /&gt;
|-&lt;br /&gt;
| 221502008 || 梁今为 &lt;br /&gt;
|-&lt;br /&gt;
| 221502009 || 李嘉洲 &lt;br /&gt;
|-&lt;br /&gt;
| 221502010 || 梁志浩 &lt;br /&gt;
|-&lt;br /&gt;
| 221502014 || 施翔 &lt;br /&gt;
|-&lt;br /&gt;
| 221502015 || 王天宇 &lt;br /&gt;
|-&lt;br /&gt;
| 221502017 || 卢君和 &lt;br /&gt;
|-&lt;br /&gt;
| 221502018 || 陈正道 &lt;br /&gt;
|-&lt;br /&gt;
| 221502019 || 黄诗雅 &lt;br /&gt;
|-&lt;br /&gt;
| 221502020 || 李维岩 &lt;br /&gt;
|-&lt;br /&gt;
| 221502024 || 杨栋凯 &lt;br /&gt;
|-&lt;br /&gt;
| 221502025 || 宋相廷 &lt;br /&gt;
|-&lt;br /&gt;
| 221830206 || 李君羡 &lt;br /&gt;
|-&lt;br /&gt;
| 221840201 || 钟锦立 &lt;br /&gt;
|-&lt;br /&gt;
| 221840262 || 孙纯洁 &lt;br /&gt;
|-&lt;br /&gt;
| 221840315 || 凌枫 &lt;br /&gt;
|-&lt;br /&gt;
| 221850025 || 高维康 &lt;br /&gt;
|-&lt;br /&gt;
| 221870052 || 吴隽雨 &lt;br /&gt;
|-&lt;br /&gt;
| 221870199 || 黄一凡 &lt;br /&gt;
|-&lt;br /&gt;
| 221870222 || 刘烨 &lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
共 69 人&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=%E8%AE%A1%E7%AE%97%E6%96%B9%E6%B3%95_Numerical_method_(Spring_2024)&amp;diff=12398</id>
		<title>计算方法 Numerical method (Spring 2024)</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=%E8%AE%A1%E7%AE%97%E6%96%B9%E6%B3%95_Numerical_method_(Spring_2024)&amp;diff=12398"/>
		<updated>2024-05-14T16:06:20Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: /* Assignments */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox&lt;br /&gt;
|name         = Infobox&lt;br /&gt;
|bodystyle    = &lt;br /&gt;
|title        = &amp;lt;font size=3&amp;gt;计算方法&lt;br /&gt;
&amp;lt;br&amp;gt;Numerical method&amp;lt;/font&amp;gt;&lt;br /&gt;
|titlestyle   = &lt;br /&gt;
&lt;br /&gt;
|image        = &lt;br /&gt;
|imagestyle   = &lt;br /&gt;
|caption      = &lt;br /&gt;
|captionstyle = &lt;br /&gt;
|headerstyle  = background:#ccf;&lt;br /&gt;
|labelstyle   = background:#ddf;&lt;br /&gt;
|datastyle    = &lt;br /&gt;
&lt;br /&gt;
|header1 =Instructor&lt;br /&gt;
|label1  = &lt;br /&gt;
|data1   = &lt;br /&gt;
|header2 = &lt;br /&gt;
|label2  = &lt;br /&gt;
|data2   = 刘景铖&lt;br /&gt;
|header3 = &lt;br /&gt;
|label3  = Email&lt;br /&gt;
|data3   = liu [at] nju [dot] edu [dot] cn  &lt;br /&gt;
|header4 =&lt;br /&gt;
|label4= Office&lt;br /&gt;
|data4= 计算机系 516&lt;br /&gt;
|header5 = Class&lt;br /&gt;
|label5  = &lt;br /&gt;
|data5   = &lt;br /&gt;
|header6 =&lt;br /&gt;
|label6  = Class meetings&lt;br /&gt;
|data6   = 周三 14:00-16:00 &amp;lt;br&amp;gt; 仙 Ⅱ-303&lt;br /&gt;
|header7 =&lt;br /&gt;
|label7  = Place&lt;br /&gt;
|data7   = &lt;br /&gt;
|header8 =&lt;br /&gt;
|label8  = &lt;br /&gt;
|data8   = &lt;br /&gt;
|header9 = Textbooks&lt;br /&gt;
|label9  = &lt;br /&gt;
|data9   = &lt;br /&gt;
|header10 =&lt;br /&gt;
|label10  = &lt;br /&gt;
|data10   = &lt;br /&gt;
|header11 =&lt;br /&gt;
|label11  = &lt;br /&gt;
|data11   =  Timothy Sauer &amp;lt;br&amp;gt;数值分析 （Numerical Analysis）（原书第2版）.&amp;lt;br&amp;gt; 机械工业出版社.&lt;br /&gt;
|header12 = Teaching Assistants&lt;br /&gt;
|data13= 傅心语，于逸潇&lt;br /&gt;
|label14= Email&lt;br /&gt;
|data14=  {xyfu, yixiaoyu} [at] smail [dot] nju [dot] edu [dot] cn&lt;br /&gt;
|label15= Office&lt;br /&gt;
|data15=计算机系 410&lt;br /&gt;
|belowstyle = background:#ddf;&lt;br /&gt;
|below = &lt;br /&gt;
}}&lt;br /&gt;
=Announcement=&lt;br /&gt;
*Welcome&lt;br /&gt;
=Course info=&lt;br /&gt;
*&#039;&#039;&#039;Instructor&#039;&#039;&#039;: 刘景铖 ( liu [at] nju [dot] edu [dot] cn )&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Teaching assistants&#039;&#039;&#039;: 傅心语，于逸潇&lt;br /&gt;
*&#039;&#039;&#039;TA email&#039;&#039;&#039;: {xyfu, yixiaoyu} [at] smail [dot] nju [dot] edu [dot] cn&lt;br /&gt;
*&#039;&#039;&#039;Homework email&#039;&#039;&#039;: nm_nju_2024@163.com&lt;br /&gt;
*&#039;&#039;&#039;Class meeting&#039;&#039;&#039;:周三 14:00-16:00， 仙 Ⅱ-303&lt;br /&gt;
*&#039;&#039;&#039;Office hour&#039;&#039;&#039;: 周二 16:00-18:00?, 计算机系516 (subject to change)&lt;br /&gt;
*&#039;&#039;&#039;QQ群&#039;&#039;&#039;: 855212527.(加入时需报姓名、专业、学号)&lt;br /&gt;
&lt;br /&gt;
=Textbooks and Readings=&lt;br /&gt;
*数值分析 （Numerical Analysis）（原书第2版）. Timothy Sauer.   机械工业出版社.&lt;br /&gt;
*[https://people.csail.mit.edu/jsolomon/share/book/numerical_book.pdf Numerical Algorithms: Methods for Computer Vision, Machine Learning, and Graphics.  Justin Solomon. CRC Press]&lt;br /&gt;
*[https://www.cs.yale.edu/homes/vishnoi/Lxb-Web.pdf Lx=b, Laplacian Solver and Their Algorithmic Applications.  Nisheeth K. Vishnoi.]&lt;br /&gt;
如果在获取教材方面有困难可以联系助教。(仅限英文版)&lt;br /&gt;
&lt;br /&gt;
= Collaboration on Homework =&lt;br /&gt;
You are welcome to work on homework problems in study groups of no more than 3 people; however, you must always write up the solutions on your own, listing all collaborators at the top. Similarly, you may use books or online resources to help solve homework problems, but you must always credit all such sources in your writeup and you must never copy material verbatim.&lt;br /&gt;
&lt;br /&gt;
We believe that most students can distinguish between helping other students and cheating. You may discuss approaches but your solution must be written by you and you only. You should acknowledge everyone whom you have worked with or who has given you any significant ideas about the homework.&lt;br /&gt;
&lt;br /&gt;
Further, it is your responsibility to ensure that your solutions will not be visible to other students. If you use Github or another source control system to store your solutions electronically, you must ensure your account is configured so your solutions are not publicly visible. Many popular version control systems provide free repositories to students.&lt;br /&gt;
&lt;br /&gt;
As a final note, we’d like to point out that collaboration on homework, while permitted, can be detrimental to your learning if misused. In particular, avoid collaborations where you do not contribute enough to your own satisfaction. Such a collaboration not only cheats you out of an opportunity to learn through homework, but can also affect your confidence. If you feel that you are not contributing enough to your group, then try to spend time thinking about the problems alone before working with your group. If you end up solving the problem all by yourself, that’s great! And if not, you’ll still be better prepared to contribute to your group.&lt;br /&gt;
&lt;br /&gt;
See also [http://www.acm.org/publications/policies/plagiarism_policy ACM Policy on Plagiarism].&lt;br /&gt;
&lt;br /&gt;
=Assignments=&lt;br /&gt;
Late policy: In general, we will accomodate late submission requests ONLY IF you made such requests ahead of time. &lt;br /&gt;
&lt;br /&gt;
# [[Media:Computational Method 2024 Assignments1 new.pdf| Homework1]] 请在 2024年03月12日23点59分之前提交到 nm_nju_2024@163.com  (文件名为&#039;学号_姓名_A1.pdf&#039;) [[计算方法 Numerical method (Spring 2024)/Homework1 提交名单| Homework1 提交名单]]&lt;br /&gt;
#[[Media:Computational Method 2024 Assignments 2.pdf| Homework2]] 请在 2024年03月26日23点59分之前提交到 nm_nju_2024@163.com  (文件名为&#039;学号_姓名_A2.pdf&#039;) [[计算方法 Numerical method (Spring 2024)/Homework2 提交名单| Homework2 提交名单]]&lt;br /&gt;
#[[Media:Computational Method 2024 Assignments 3.pdf| Homework3]] 请在 2024年04月09日23点59分之前提交到 nm_nju_2024@163.com  (文件名为&#039;学号_姓名_A3.pdf&#039;) [[计算方法 Numerical method (Spring 2024)/Homework3 提交名单| Homework3 提交名单]]&lt;br /&gt;
#[[Media:Computational Method 2024 Assignments4.pdf| Homework4]] 请在 2024年05月01日23点59分之前提交到 nm_nju_2024@163.com  (文件名为&#039;学号_姓名_A4.pdf&#039;) [[计算方法 Numerical method (Spring 2024)/Homework4 提交名单| Homework4 提交名单]]&lt;br /&gt;
#[[Media:Computational Method 2024 Assignments 5.pdf| Homework5]] 请在 2024年05月14日23点59分之前提交到 nm_nju_2024@163.com  (文件名为&#039;学号_姓名_A5.pdf&#039;) [[计算方法 Numerical method (Spring 2024)/Homework5 提交名单| Homework5 提交名单]]&lt;br /&gt;
#[[Media:Computational Method 2024 Assignments 6.pdf| Homework6]] 请在 2024年05月28日23点59分之前提交到 nm_nju_2024@163.com  (文件名为&#039;学号_姓名_A6.pdf&#039;)&lt;br /&gt;
&lt;br /&gt;
=Lecture Notes=&lt;br /&gt;
如果有下载课件的问题请及时联系助教。&lt;br /&gt;
	&lt;br /&gt;
# [[Media:计算方法1-课程简介-Spring2024.pdf| 课程简介，函数求根]]&lt;br /&gt;
# [[Media:计算方法2-插值-Spring2024.pdf| 牛顿法，插值，秘密分享，自纠错码]]&lt;br /&gt;
# [[Media:计算方法3-Chebyshev-Spring2024.pdf| Chebyshev插值与多项式，范数]]&lt;br /&gt;
# [[Media:计算方法4-最小二乘法.pdf|最小二乘法，Gram-Schmidt正交化与QR分解]]&lt;br /&gt;
# [[Media:计算方法5-高斯消元.pdf|FFT，高斯消元与LU分解]]&lt;br /&gt;
# [[Media:计算方法6-条件数和迭代法.pdf|算子范数，条件数和迭代法]]&lt;br /&gt;
# [[Media:计算方法 7-特征值与幂迭代.pdf|特征值与幂迭代]]&lt;br /&gt;
# [[Media:计算方法 8-特征值的其它迭代方法与SVD.pdf|特征值的其它迭代方法与SVD]]&lt;br /&gt;
## Further reading: [https://web.stanford.edu/class/cs168/l/l9.pdf lecture note by Tim Roughgarden and Greg Valiant on matrix completions]&lt;br /&gt;
# [[Media:计算方法9-ConjugateGradient.pdf | 迭代法解线性方程组：梯度下降方法与共轭梯度]]&lt;br /&gt;
# [[Media:计算方法10-2024.pdf | 随机游走，马尔可夫链与幂迭代]]&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=File:Computational_Method_2024_Assignments_6.pdf&amp;diff=12386</id>
		<title>File:Computational Method 2024 Assignments 6.pdf</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=File:Computational_Method_2024_Assignments_6.pdf&amp;diff=12386"/>
		<updated>2024-05-14T08:35:46Z</updated>

		<summary type="html">&lt;p&gt;Kvrmnks: Kvrmnks uploaded a new version of File:Computational Method 2024 Assignments 6.pdf&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Kvrmnks</name></author>
	</entry>
</feed>