So what you typically do and a hash case is you design your code to deal with that.
你所需要做的就是通过设计你的代码,来解决上面的问题。
What you're much better at doing is saying how do I take the problem I've got and map it into a class of algorithms about which I know and use the efficiencies of those to try and figure out how to make it work.
当你碰到问题的时候,更好的方法是把遇到的问题映射,到已经设计好的算法中去,并用这些算法来提高效率,来保证问题得到解决。
The problem is recurringly in society that it's just horrible designs.
这个问题在社会中反复地出现,那就是可怕的设计了。
When people first devise some new financial instrument it typically has trouble.
当某种金融工具刚被设计出来时,它通常会存在问题
Dissolvable stitches or sutures, now what needs to be engineered in those?
可吸收缝合线,在设计缝合线时需要注意什么问题
Now, if you're an engineer, and you use the ideal gas law to design a chemical plant or a boiler or an electrical plant, you know, a steam plant, you're going to be in big trouble.
比如说锅炉,蒸汽机,我们会遇到一个大问题:,我们设计的机器将无法运作,因为对大部分实际气体。
And what it was designed to do, was to solve that specific problem.
这就是它被设计出来的目的,用于解决某种专门的问题。
So that would be a matter of good versus bad design.
所以那是个好模式,坏设计的问题。
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.
现在,当你设计程序的时候效率,是不得不考虑的问题,虽然我必须承认,至少对我来说,我是先担心程序能不能运行,再去把它的效率优化的,我喜欢可靠点的东西。
But with this example alone can you realize -- that with some more exercise of thoughts and intelligent-- I don't wanna say intelligent design here, intelligent design can you actually solve this problem so much more efficiently and just as correctly.
但通过这一例子,你们应该能认识到,通过更多的思维训练-,在这我并不想说智能设计,你就能真正更高效,准确地,解决问题。
You try to design actually I'm going to come back to that in a second. It's like you're trying to use a hash function that spread things out pretty evenly. But the places you store into in those lists may have to themselves have a small list in there, and when you go to check something, you may have to do a linear search through the elements in that list.
你尝试着去设计,实际上过会儿我会回头讲解这个问题,类似于你需要用一个哈希函数,非常平均的将物体分发出去,但是在列表中你数据,映射到的地方可能会有自己的一小段列表,当你回头查找数据的时候,你可能需要在那一小段列表中做线性查找。
The answer is I can't. OK, in the simple case of integers I can, but in the case of something more complex like faces or fingerprints or passwords for that matter, it's hard to design a hash function that has completely even distribution, meaning that it takes any input into exactly one output spot.
答案是我不能,好吧,在简单的整数的例子中,我可以做到,但是在一些更复杂的场景中,比如面部,指纹,密码相关的问题中,很难设计一个哈希函数具备完全平均的分配,也就是说,做到对任一输入,可以准确地得到相应的唯一输出,因此在一个哈希问题中。
应用推荐