分析递归算法

发布于 2024-10-29 11:59:47 字数 831 浏览 2 评论 0原文

我经常被递归算法所困扰,这些算法似乎需要神奇的逻辑跳跃(由于墨水短缺而产生大量缩小的符号)。

我意识到另一种方法是简单地记住所有常见算法的 Big O 表示法,但在某个时刻,这种方法会失败。例如,我很乐意透露冒泡排序、插入排序、二叉树插入/删除、归并排序和快速排序的性能,但不要要求我直接提出 AVL 树或 Djikstra 的最短路径算法的性能我的头。

我在哪里可以得到:

  1. 递归算法分析的讨论,使用单词而不是大量的符号
  2. 练习问题以确认我新获得的理解实际上是正确的

示例:

坏:

Sigma ve T (1+cv)

可能的“好” ' 等价:

树中 1 个节点所需的工作量(即 1 + 节点的子节点数),然后对树中的每个元素执行一次,其中原始节点是根。

旁注:

我可以简单地观看每个算法的视频,因为没有办法让一个人的声音变成下标(或任何其他扭曲),但我怀疑与阅读文本描述相比,这会花费大量时间。

更新:

这是已解决问题的 1 个来源:http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-046j-introduction-to-algorithms-sma-5503-fall-2005 / (这解决了上面的#2)

I've often been slightly stumped by recursive algorithms that seem to require magical leaps (with a large dose of shrunken notation born of an ink shortage) of logic.

I realize that the alternative is to simply memorize the Big O notation for all the common algorithms but at a certain point, that approach fails. For example, I am happy to disclose the performance for bubble sort, insertion sort, binary tree insertion/removal, mergesort, and quicksort but don't ask me to come up with the performance of AVL trees or Djikstra's shortest path algorithm off the top of my head.

Where can I go to get:

  1. A discussion of recursive algorithm analysis that uses words instead of a profusion of symbols
  2. Practice problems to confirm that my newly-obtained understanding is actually correct

Example:

Bad:

Sigma v e T (1+cv)

Possible 'good' equivalent:

The amount of work required for 1 node in the tree (which is 1+the # of children of a node), which is then executed once for every element in the tree where the original node is the root.

Side commentary:

I could simply watch a video for every single algorithm because there's no way to make one's voice turn into a subscript (or any of the other contortions) but I suspect that would take an inordinate amount of time compared to reading textual descriptions.

Update:

Here's 1 source of solved problems: http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-046j-introduction-to-algorithms-sma-5503-fall-2005/ (this tackles #2 above)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

笑看君怀她人 2024-11-05 11:59:47

TopCoders 拥有大量教程和详尽的解释。你尝试过吗?

http://www.topcoder.com/tc?d1=tutorials& ;d2=alg_index&module=静态

TopCoders has a great source of tutorials and thorough explanations. Have you tried them out?

http://www.topcoder.com/tc?d1=tutorials&d2=alg_index&module=Static

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文