I'm going to start somewhere near the middle of the code. Again, a lot of times, people don't do that.
我会在代码中间的某个位置开始,再说一次,很多时候人们不会这么做。
Having now used this pseudo code to line things up, I can start putting some additional structure on this.
用伪代码把这些事情串起来后,我可以开始进行,一些结构方面的优化了。
Sudoku And then Sudoku we did last year where it actually becomes a little more interesting where we start providing students not with a blank slate, but with some distribution code.
我们去年做的,实际上更有意思,我们给学生的不是一块白板,而是一些分布式代码。
Right, so the things we want you to take away from this are, get into the habit of using pseudo code when you sit down to start a problem, write out what are the steps.
好,这儿我想大家明白的就是,养成解决问题时先写伪代码的好习惯,把步骤都写出来,我想要告诉你们的是一个好的程序员。
OK. Let's simulate the code. Let's see what it's doing here. All right, so we start off.
让我们看看这里到底做了神马?,好的,我们开始吧。
Again, I want you to start seeing how to map the characteristics of the code- the characteristics of the algorithm, let's not call it the code-- to the complexity.
是算法中的那些特性,我们还是别说代码了,转化为复杂度-,我一会儿还会再讲点儿这个的,但是我们再看一个例子。
When we start writing code, you're going to see that difference, but for now, don't worry about it, I just want to plant that idea.
当我们开始写代码的时候,你就会看到区别了,但是现在别担心,我只是想让你们初步有个印象。
Now, efficiency is obviously an important consideration when you're designing code, although I have to admit, at least for me, I usually want to at least start initially with code that works, and then worry about how I might go back and come up with more efficient implementation.
现在,当你设计程序的时候效率,是不得不考虑的问题,虽然我必须承认,至少对我来说,我是先担心程序能不能运行,再去把它的效率优化的,我喜欢可靠点的东西。
When we start building up code, we're going to use commands. Or statements.
当我们写代码的时候,我们会用到命令或者声明。
Today, I'm gonna start writing C code with you but I can't just write it and expect it to do anything.
现在,我和大家一起写C语言代码,但我不指望写出来后就能跑起来。
应用推荐