Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6663753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:32:02+00:00 2026-05-26T02:32:02+00:00

Not sure whether it is sensible reopen my earlier thread on Hashing URL .

  • 0

Not sure whether it is sensible reopen my earlier thread on Hashing URL.
Nonetheless, I am still curious know how this work undercover.

Assumption: We have a hashtable with n (where n < Infinity) element where asymptotic time complexity is o(1); we (CLR) have achieved this while applying some hashing function ( Hn-1 hash function where n>1).

Question: Can someone explain me how CLR map Key to the hash code when we seek (retrieve) any element (if different hashing functions are used)? How CLR track (if it) the hashing function of any live object (hash table)?

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T02:32:02+00:00Added an answer on May 26, 2026 at 2:32 am

    Conceptually, there are two hash functions. The first hash function, as you probably have guessed, is the key object’s GetHashCode method. The second hash function is a hash of the key returned by the first hash function.

    So, imagine a hash table that has a capacity of 1,024 items, and you’re going to insert two keys: K1 and K2.

    K1.GetHashCode() returns 1,023. K2.GetHashCode() returns 65,535

    The code then divides the returned key by the hash table size and takes the remainder. So both of the keys map to position 1,023 in the hash table.

    K1 is added to the table. When it comes time to add K2, there is a collision. So the code resorts to the second hash function. That second hash function is probably a “bit mixer” (often the last stage in calculating a hash code) of some sort that randomizes the bits in the returned key. Conceptually, the code would look something like this:

    int hashCode = K2.GetHashCode();
    int slot = hashCode % 1024;
    if (table[slot] != null)
    {
        int secondHashCode = BitMixer(hashCode);
        slot = secondHashCode % 1024;
    }
    

    The point here is that the code doesn’t have to keep track of multiple hash functions for the different keys. It knows that it can call Key.GetHashCode() to get the object’s hash code. From there, it can call its own bit mixer function or functions to generate additional hash codes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not sure whether this is an SO question but still would like to
I am not sure whether this only happens to me. Basically if I have
I'm not sure whether or not this is the appropriate way of doing this,
I'm not sure whether this question belongs on StackOverflow or SuperUser, but here goes
I am not sure whether I am asking this with the right words, I
I am not sure whether distinct is the right word for this. I have
we're having this toshiba barcode printer. I'm not sure whether this problem is hardware
Not sure whether this pertains to VS 2010 or to the upgraded framework, but...
I am not sure whether it is possible to achieve this kind of implementation
I'm not sure whether it is the right terminology for this kind of relationship,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.