But we said earlier that, you know, we're going to get - to the point where we want to have a lot of pieces of -- a lot of variables in memory, maybe 140,000 dictionary words for some future peace set, but we don't want to enumerate line by line by line 140,000 variables.
但是我们之前说过,你们知道的,我们将获得,有很多块--很多变量的内存的指针-,可能有140,000个单词的集合,但是我们不想一行行地列举,140,000行变量。
So I'm going to solve this by enumerate and check, which is an example of what's called a brute-force algorithm.
你懂的,所以我得靠列举和检验来解决这个问题,这就是我们说的穷举算法。
And then what I get to do inside the curly braces is literally line by line enumerate the cases that I want to apply to the following code.
然后我们在花括号中要做的是,逐行地列举接下来我想要,应用的代码。
That's certainly one way to do it, but for computers that's not necessarily the easiest way. So another way of solving it is to do something we already saw last time, which is basically, why not simply enumerate all possible examples and check them?
将一个等式代入另一个等式,这当然是一种办法,但是对电脑来说这绝对不是一件简单的事,所以解决这个问题的办法,正如我们上一次看过的,非常基本?
But when you start writing programs, especially when we get to web-based stuff where you want -- to check the user's input -- is it valid, is it an email address, -- and all these different scenarios -- it's actually often useful to be able to just enumerate them or rattle them off using this switching construct instead.
但是当你看是写程序时,特别是当我们,使用基于网络的东西,你想要,检查用户的输入-,它是合法的吗?它是不是一个电子邮箱地址?,所有的这些场景-,实际上它常常是有用的,当你用枚举结构列举它们,或者用它来快速地来说出它们。
应用推荐