Talking about the hash

Source: Internet
Author: User

We all know that the Python dictionary is made up of key,value. You should have heard that the dictionary is looking for a certain value fast, so why?

This is because the dictionary uses the technique of "hashing". So what exactly is a hash?

{Here is a qualification, we only discuss the use of hashing in the implementation of finding this single function, not as a mechanism for encrypting and guaranteeing file integrity, nn.}

Here in order to explain what the hash is, I'm going to do a very non-forbidding metaphor

We have used 360, in the visit "certain" pages, that will not be reported to remind XXXX. Well, we can guess that there's a form inside of him. All unqualified URLs are recorded on it. Then join the 100 million such domain name, then in most cases is better than many times, then we can mark these URLs we can use the characteristics of the algorithm to distinguish them from different tags. And then we'll put these in the array, so if we want to know if our element is in this set, we'll just count the domain name you've visited, and then look at the tag in the array that doesn't hold the tag. Can. {You might say this is different from not having a hash--go ahead and look at my post on List Ps: Here's an array of Python, which is exactly the case, if .... LOL

So what is the complexity of the hash here---it turned out to be Changshu grade ...

But from the text we know that this is a way of using space to change time. The actual is the space consumption brought the disadvantage, far to conceal its performance advantages, so you understand ...

Talking about the hash

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.