算法与计算机科学discrete.gr
算法复杂度分析简明入门
A Gentle Introduction to Algorithm Complexity Analysis
2012 — 2018,它一次次回到首页
黑点是上首页(≥ 50 分)的那次投稿,空心点是没冲上去的投稿,点越大分数越高。
导读
这是一篇算法复杂度分析的入门教程,用通俗易懂的方式讲解 Big-O 表示法以及如何分析算法的时间复杂度。它多次登上 Hacker News 首页,被许多读者视为复杂度分析的最佳入门读物之一。
为什么经久不衰:它把通常枯燥抽象的 Big-O 分析讲得平易近人,是初学者反复被推荐的经典入门材料,多年后依然适合作为学习算法的第一课。
HN 评论精选
对只保留最高阶项的简化做法提出疑问
好文章。我理解 Big-O 的概念和意义,但一直不懂具体怎么做分析。有个问题:文章说只考虑增长最快的部分,比如 n² + 2n 就是 n²。但为什么要这样?如果算法是 n¹² 加上很多个 n² 项,我们真的能忽略那些 n² 吗?
mbenjaminsmith查看英文原文
Great article. I've understood the why and what of Big-O but never how to do the analysis. I have a question for the informed however: The article says that we only consider the fastest growing parts of an algorithm. So, counting instructions, n^2 + 2n would just be n^2. But why do we do that? Imagine an algorithm where we have n^12 + n^2 + n^2 + n^2 + n^2, etc. Do we really ignore each n^2 section? [Edited]
推荐《算法设计手册》作为深入学习的补充
对这个主题感兴趣的人,我强烈推荐 Steven Skiena 的《算法设计手册》。书的前四分之一对复杂度分析讲得很详细。这是我第一次接触算法复杂度分析,读完那部分后我看待自己代码的眼光都不一样了。
ssurowiec查看英文原文
For anyone interested in this subject I'd highly recommend the Algorithm Design Manual by Steven Skiena[0]. He goes over this in pretty good detail in the first ~1/4 of the book. This was my first introduction to Algorithm Complexity Analysis and by the end of that section I already found myself looking at my code in a different light. [0] http://www.amazon.com/dp/1849967202
建议配合斯坦福算法课一起学习
我一直在上 Coursera 上 Tim Roughgarden 的斯坦福算法课,课程也讲 Big-O 和算法分析。这篇文章读起来令人耳目一新,如果想深入,我强烈建议把它和那门课搭配着学。
tsurantino查看英文原文
I've been doing the Coursera course on Algorithms (from Stanford by Tim Roughgarden). He's going over concepts like Big-O notation as well as analyzing algorithms. This particular article is a refreshing read, and I would highly suggest the Coursera course as an accompaniment if someone wants to go deeper.
推荐另一本更零基础的入门书《算法图解》
《算法图解》(Grokking Algorithms) 里对 Big-O 的讲解对我来说最清晰。它不预设任何知识,甚至在使用对数和二分查找举例之前先重新介绍了它们。
modernerd查看英文原文
The explanation of Big O in Grokking Algorithms was clearest for me. It doesn't assume any knowledge and even re-introduces logarithms and binary search before using them in examples: - Logarithms and binary search: https://livebook.manning.com/#!/book/grokking-algorithms/chapter-1/ - Big O: https://livebook.manning.com/#!/book/grokking-algorithms/chapter-1/87
历次讨论
同类还值得读
位运算技巧集
Bit Twiddling Hacks
斯坦福页面上的经典位运算技巧合集,收录了 popcount、前导/尾随零、位反转、交换、舍入等大量技巧,并附有解释和性能讨论。
算法与计算机科学上首页 8 次 · 2011–2024graphics.stanford.edu编辑精选如何不按平均评分排序
How Not To Sort By Average Rating
经典文章解释了为什么按平均评分排序不可靠:只有少量评价的条目(比如仅一条五星)会轻易排到最前,而评价数量的差异被忽略。
算法与计算机科学上首页 7 次 · 2009–2024evanmiller.org编辑精选数据结构可视化
Data Structure Visualizations
旧金山大学 David Galles 教授制作的数据结构与算法交互式可视化网站,涵盖 B 树、红黑树、排序、图算法等,可逐步操作观察其运行过程。
算法与计算机科学上首页 6 次 · 2011–2021cs.usfca.edu编辑精选1996 年以来的计算机科学最佳论文奖
Best Paper Awards in Computer Science since 1996
Jeff Huang 维护的一个汇总页面,收录了自 1996 年以来计算机科学各主要会议的“最佳论文奖”获奖名单,并按年份和会议整理,方便读者一站式浏览历届获奖论文。
算法与计算机科学上首页 6 次 · 2010–2018jeffhuang.com编辑精选算法(Jeff Erickson)
Algorithms, by Jeff Erickson
伊利诺伊大学 Jeff Erickson 教授的算法课教材,免费在线开放。
算法与计算机科学上首页 5 次 · 2018–2022jeffe.cs.illinois.edu编辑精选