回到基础:算法和虚拟学校

Before I graduated from College/University I was convinced that school was for lamers. Then I graduated from school and decided that NOT going to school was for lamers. That shows you what a wishy-washy person *I* am. ;) School is for some folks and not for others. Wear the shoe that fits you best.

在我从学院/大学毕业之前,我深信这所学校是为拉默人开设的。 然后,我从学校毕业,并决定不上学是为拉默。 那告诉你*我*是个贪吃的人。 ;)学校是为某些人而不是其他人。 穿上最适合您的鞋子。

Totally random retrospective self-focused aside: I graduated from OIT with a BS in Software Engineering in 2003. Yes, that's 2003. It took me only 11 years to get a 4-year degree. ;) I've been a programmer since 1992, so about 16 years, but 11 of those I was going to school at night. Basically I worked 9a-5p and went to school 6p-10p. For the first few years I took a lot of courses, but then work happened and I tapered off to one course a term. This was fine for a long time but then credits started falling off the other side. Basically courses I took 7+ years before became obsolete. I actually lived through four Deans while I was there. I made a deal with one of them that if I taught .NET I could keep my credits longer. That let me keep taking courses while working the whole time. The result took 11 years and two schools. But now I can just say, "I've got my degree and just not mention that I got it 5 years ago. Don't tell. Lots of experience sounds better than "slow learner at school."

除了完全随机的回顾性自我聚焦之外:我于2003年毕业于OIT ,获得软件工程学士学位。是的,那是2003年。我花了11年的时间就获得了4年的学位。 ;)自1992年以来我一直是一名程序员,大约16年了,但是其中11个是我晚上上学的。 基本上我工作9a-5p,然后去上学6p-10p。 在最初的几年里,我参加了很多课程,但是后来工作又开始了,我每学期只修一门课程。 长期以来这还不错,但是信用开始下降。 基本上,我修了7年以上的课程才过时了。 我在那里的时候实际上住过四个院长。 我与其中一位达成协议,如果我教.NET,则可以延长学分。 这使我可以在整个工作期间继续上课。 结果用了11年零两年的时间。 但是现在我只能说:“我已经获得了学位,只是没有提到我5年前就获得了学位。不要告诉。很多经验听起来比“学校学习缓慢”要好。

Whether you went to school or are self-taught, even though the Internet was originally more a place to put academic papers than a place to meet "friends", there's a LOT more really good academic information on the web than I remember. It also takes more interesting forms than just pages of class syllabi. Here's the syllabus for the CST407 class I taught in Fall of 2003.

无论您是去学校还是自学成才,尽管互联网原本是放置学术论文的地方而不是结识“朋友”的地方,但网上有很多真正好的学术信息比我记得的要多。 除了类大纲的页面之外,它还采取了更有趣的形式。 这是我在2003年秋季教的CST407课程的提纲。

You can learn via Googling, you can learn via Book Readin' but you can also setup a more focused "curriculum" for yourself. I know a lot of devs that I admire that do this. They'll pick a discipline, area, language, whatever, and create a mini-class for themselves. Actually that much-teased "Learn Whatever in 24 Hours" books have more structure in this way than most programming books.

您可以通过谷歌搜索学习,也可以通过“读书阅读”学习,但是您也可以为自己设置一个更专注的“课程”。 我知道很多开发人员对此很佩服。 他们将选择学科,领域,语言等等,并为自己创建一个微型课程。 实际上,与大多数程序设计书相比,被嘲弄的“ 24小时内学习一切”书以这种方式具有更多的结构。

These days there's all the good content at iTunesU from colleges that didn't return my calls back in my High School years. There's even 1986 video of the legendary MIT lectures "Structure and Interpretation of Computer Programs" with Hal Abelson and Gerald Jay Sussman. There's MIT's excellent OpenCourseWare Videos of the Introduction to Algorithms class up on Google Video.

如今,大学的iTunesU上有很多不错的内容,这些东西在我高中时代都没有给我回电话。 甚至还有1986年的MIT传奇录像带的视频,该录像带是Hal Halbel和Gerald Jay Sussman讲的“计算机程序的结构和解释”在Google Video上MIT出色的《算法入门》课程的OpenCourseWare视频

Professors are creating better and better tools to visualize things, like this amazing JavaScript-based page on "Animated Sorting Algorithms" by David R. Martin. It's utterly brilliant, not just because it's a Visualizer, but because the code is in Javascript, so you're seeing it happen. It's impressive like when you're playing a video game and you discover a particularly amazing cut-scene isn't prerendered, it's rendered in-engine. (UPDATE: And it would be impressive if it were true. I'm crushed. They ARE prerendered. Well, still. It's cool. Thanks, Adam!)

教授们正在创造越来越多的工具来可视化事物,例如David R. Martin撰写的有关基于JavaScript的令人惊叹的“动画排序算法”页面 它非常出色,不仅因为它是一个可视化工具,而且因为代码是用Javascript编写的,所以您会看到它的发生。 令人印象深刻的是,当您在玩电子游戏时,发现没有特别渲染的过场动画是在引擎中渲染的。 (更新:如果这是真的,那将是令人印象深刻的。我被压碎了。他们被渲染了。嗯,还是。很酷。谢谢,亚当!)

I recently stumbled on Massimo Di Pierro's site and his code. He's got a CSC309/321 class that he teaches at DePaul University and has a great Python application called "Algorithms Animator." His slides on basic OOP in C++ are excellent but the Algorithms Animator is really cool. There's a video of Algorithms Animator running over at Vimeo.

最近,我偶然发现了Massimo Di Pierro的网站他的代码。 他在DePaul大学教了一个CSC309 / 321课,并且有一个很棒的Python应用程序叫做“ Algorithms Animator”。 他的C ++基本OOP幻灯片非常出色,但是Algorithms Animator确实很棒。 Vimeo上有一段视频播放着Algorithms Animator

He's got all sorts of common algorithms, sorts, traversals, searches, etc. The algorithms are all in src/csc321algorithms.py, like this simple binary tree example.

他具有各种通用算法,排序,遍历,搜索等。这些算法都在src / csc321algorithms.py中,就像这个简单的二叉树示例一样。

def isNullTree(tree):
if tree is None: return true
if len(tree)==0: return true
return false

rootnode=0
leftchild=1
rightchild=2

def BinaryTree(node,left=[],right=[]):
list=[node,left,right]
if not isNullTree(left):
left[rootnode].parent=list
if not isNullTree(right):
right[rootnode].parent=list
return list

There's also more complex ones like a Huffman encoding example. But it's not the source code that interesting, although it is. The syllabus is really detailed, with the kind of detail you really only see in academia:

还有更复杂的示例,例如霍夫曼编码示例。 但这不是源代码那么有趣,尽管它是如此。 教学大纲确实很详细,只有在学术界才真正看到的那种细节:

Huffman Encoding Definition: A minimal variable-length character encoding based on the frequency of each character. First, each character becomes a trivial tree, with the character as the only node. The character's frequency is the tree's frequency. The two trees with the least frequencies are joined with a new root which is assigned the sum of their frequencies. This is repeated until all characters are in one tree. One code bit represents each level. Thus more frequent characters are near the root and are encoded with few bits, and rare characters are far from the root and are encoded with many bits.

霍夫曼编码定义:基于每个字符的频率的最小可变长度字符编码。 首先,每个字符成为一个琐碎的树,其中该字符是唯一的节点。 角色的频率就是树的频率。 频率最低的两棵树与新的根相连,并为其分配了频率之和。 重复此操作,直到所有字符都在一棵树中为止。 一个代码位代表每个级别。 因此,更频繁的字符在根附近,并且用很少的比特编码,而稀有字符在根附近,并且用很多比特编码。

The Program accepts the text to be compresses as input and produces a text report showing compression rules and compressed text. The Program also shows in an animation how the Huffman tree is built.

本程序接受要压缩的文本作为输入,并生成显示压缩规则和压缩文本的文本报告。 该程序还以动画形式显示霍夫曼树的构建方式。

Huffman encoding provides an example of Greedy strategy.

霍夫曼编码提供了贪婪策略的示例

What's cool about this guy's way of teaching algorithms is that his app uses animation to show the algorithm happening step by step.

这个人教授算法的方法最酷的是,他的应用程序使用动画来逐步显示算法的发生。

For example, if I use Huffman Encoding on the string "Scott Hanselman," here's Frame 0 of the animation.

例如,如果我对字符串“ Scott Hanselman”使用霍夫曼编码,则为动画的第0帧。

"First, each character becomes a trivial tree, with the character as the only node."

“首先,每个字符都变成一个琐碎的树,以该字符为唯一节点。”

Here's Frame 15 as the the character's frequencies are counted and the tree is in the process of being built.

这是第15帧,因为已计算角色的频率,并且树正在构建中。

"One code bit represents each level. Thus more frequent characters are near the root and are encoded with few bits, and rare characters are far from the root and are encoded with many bits."

“一个代码位代表每个级别。因此,更频繁的字符位于根附近,并用很少的比特进行编码,而稀有字符远离根并使用许多位进行编码。”

Here's Frame 22 as the tree has been built out and the bit values are applied.

这是第22帧,因为树已被构建并应用了位值。

...and the result is in the image below showing the compression rules/map and the final bits.

...结果在下面的图像中显示了压缩规则/映射和最后的位。

image

I'm not sure about you, but I'm not able to bust out a QuickSort on a whiteboard under pressure anymore (I'm old).  I found this guy's stuff to be a great algorithms refresher, and using the little Python app to explore them made it very enjoyable. I wish we had this kind of stuff when I was in school. It's kind of nice to pretend I'm back in an Algorithms class and tickle the neurons that haven't fired in a while.

我不确定您的身份,但是我无法再承受白板上的QuickSort破坏(我已经老了)。 我发现这家伙的资料是很棒的算法复习,并且使用小型Python应用程序对其进行了探索,使它非常有趣。 我希望我们在学校的时候有这种东西。 假装我回到了Algorithms类,并挠痒了一段时间没有激发的神经元,真是太好了。

Related Posts

相关文章

翻译自: https://www.hanselman.com/blog/back-to-basics-algorithms-and-going-back-to-virtual-school

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值