这种算法的正确性是很显然的。
这种算法被称为掠夺交易。
有关这种算法的形式证明请参阅 参考资料。
It's a problem, as you'll see, designed to give you some practice at dealing with some of the, dare I say, more theoretical concepts we've covered in class.
这种问题会让你在处理我们,课堂上并没有讲到的更多,理论概念这方面上有更多实践,这种问题就像算法复杂度一样。
You might remember vaguely logarithms from high school math and such but what this suggests for us , the computer scientists, is that this is certainly a smarter, a faster algorithm.
你可能还会依稀记得,高中数学里的对数,这就给了我们这些计算机科学家们,一些启示,即,这种算法更智能,更迅速。
So when I do the analysis, I want to think about what am I doing here, am I capturing all the pieces of it? Here, the two variables that matter are what's the length of the list, and how many times I'm going to search it?
这里,要关注的,两个变量是列表,的长度以及我要搜索的次数,这种情况下,这个算法赢了?
应用推荐