• Therefore, for simple branching programs, the length of time, the complexity the code, is what we would call constant.

    因此,对于简单的分支程序,运行的时间长度,算法的复杂度,也就是我们说的常数。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • I'm thinking about a problem, I'm going to show you an example in a second, first thing I'm going to do is say, what is the thing that's going to change every time I run through the same set of code?

    我要解决一个问题,我马上会让大家看一个例子,第一件我要做的事情就是,弄明白每次运行同样的指令集时,每次都会改变的东西是什么?

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • Well, the first line of code, I'll fix the purple next time around so it's more legible.

    第一行代码,我用紫色标记,这样增加了可读性。

    哈佛公开课 - 计算机科学课程节选

  • I can change everything overnight; it does happen. I put that in for a reason because sometimes some of you have not taken a physics course and you don't know how to do well in physics and slowly you catch on and by the time it's Final exam you crack the code; you know how to do well.

    我能一夜之间扭转乾坤,确实有过这样的例子,我这样做是因为,有时你们中有人可能以前没上过物理课,不知道怎样学好物理,但慢慢地你赶了上来,到期末考试的时候,你忽然灵光一闪,考起试来得心应手

    耶鲁公开课 - 基础物理课程节选

  • And I want to remind you, that block of code is a set of instructions, the same set of instructions that are going to be done each time through the loop.

    我想提醒大家,这块代码是一个指令集,一个每次循环都会被执行的相同指令集,会变化的仅仅是变量的值。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • I'm much better having an exception get handled at the time of input than to let that prop -- that value rather propagate through a whole bunch of code until eventually it hits an error 17 calls later, and you have no clue where it came from.

    不是我期望的格式,这时我最好有一个异常处理,而不是让其传下去,这个值传到代码的整个分支,最终会导致一个错误17调用的发生,并且你不知道这个错误是哪里来的。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • Because there will not be time to look at that code for the first time during the quiz, and figure out what it's doing.

    因为在考试中,是没有时间去第一次看代码,并弄懂它的意思的。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • I stress it in particular because I know you're all going to get into this stage; you've got a problem set due in a couple of hours, you're still writing the code, you don't want to waste time, and I'm going to use quotes on "waste time", doing those extra things to do the defensive programming, you just want to get the darn thing done.

    我特别强调了这一点,因为我知道你们都会慢慢成为程序员;,你在写代码过程中造成了一系列的错误,你还在写代码,你不想浪费时间,我想把“浪费时间“用引号圈起来,浪费时间来做因为防卫性程序设计,而带来的这些额外的事情,你只想赶紧把程序写完,这不是一个好习惯,因为当你做完回头。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • Remember last time, I said that there's different kinds of complexity in our code, and I suggested for simple branching programs, the amount of time it takes to run that program is, in essence, bounded by the number of instructions, because you only execute each instruction at most once.

    但是这里有个很重要的点,记得上节课,我提过在我们的代码中,有不同种类的复杂度,而且我还说了对于简单的分支程序,运行这种程序需要的总体时间,大体上,是和指令的数目相关的,因为每个指令只会被执行最多一次。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • So really, the rule of thumb if you think back to Scratch is -- that any time you write a statement -- -- something that does something in one line of code -- you generally need the semicolon there.

    实际上,根据经验,你们回忆一下在Scratch中,任何时候你们写一条语句-,处理一些操作的一行代码-,你们通常需要在那里加个分号。

    哈佛公开课 - 计算机科学课程节选

  • Right? If that was the case in that code, then my complexity is no longer log, because I need linear access for each time I've got to go to the list, and it's going to Lisp be much worse than that.

    这里的复杂度不再是对数的了,因为每次在列表中,查找需要线性访问,可能还要糟糕,其实,有些编程语言,如。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • You want to write the specs so that everybody does in fact know what this piece of code is doing, and you're writing it each time around.

    但是你得养成良好的习惯和编程风格,你得撰写规范说明从而保证,每个人都知道这段代码是干什么的。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • Yeah, if my machine will come back up, there we go. So, I'm going to now go ahead and write a little piece of code, and I put it here and I hope you can actually see these better this time, let me uncomment that region.

    让我们写出代码来吧,好,如果我的电脑能回来的话,好了,那么,我要去写一小块代码,我把它放在这里以期望大家这次,能看的更清楚点。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • Remember last time, we wrote this simple piece of code to print out even or odd. If, you know, x, 1 it was in fact, even or odd. So let me show you what a flow chart for that would look like, because I want to make a comparison point here.

    这就像这里有一些脚蹼一样,首先进行测试,然后把球这样放来让ANS加,然后回来继续测试,最终跳出循环然后打印答案。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • So this line or these lines of code up here are arguably constant time steps to say if N is less than 2 in return, that it will always take maybe one step, maybe two steps, some number of fixed CPU cycles.

    如果N小于2并返回,那么这些行所对应的代码,通常只需要执行一步,或者两步,具体数字与CPU周期有关。

    哈佛公开课 - 计算机科学课程节选

  • The standard library, that first line of code, it's not strictly necessary but any time you use a function, a tool that someone else wrote that lives in that so called library, you do need that include line as we'll see.

    标准库函数--第一行代码,严格来说,不是每次都要写的,但是一旦你调用某个别人写,的函数,而这个函数又恰巧位于标准库里面,你就要像我们看到的这样,把它include进去。

    哈佛公开课 - 计算机科学课程节选

  • So the interpreter is simply operating directly on your code at run time.

    因此解释器在运行程序的时候,会直接的对你的代码进行操作。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • Most of the time, we're going to be doing expressions inside of some piece of code, inside of a script, which is the Python word for program.

    大多数情况下,我们会在一些代码内部,写一些表达式,在一个脚本里面,也就是Python里面对程序的另一种叫法。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • Remember last time, we wrote this simple piece of code to print out even or odd. If, you know, x, it was in fact, even or odd. So let me show you what a flow chart for that would look like, because I want to make a comparison point here.

    记得上节课我们写过的,那个显示奇数还是偶数的程序么,如果,你知道,x,实际上是奇数还是偶数,那么让我来为大家画个这个程序的流程图吧,因为我这里想为大家做个比较。

    麻省理工公开课 - 计算机科学及编程导论课程节选

$firstVoiceSent
- 来自原声例句
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定