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 6820963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:29:19+00:00 2026-05-26T21:29:19+00:00

This is the question: Uses open addressing by double hashing, and the main hash

  • 0

This is the question:

Uses open addressing by double hashing, and the main hash
function is hi(x) = (hash(x) + f(i)) mod M, where hash(x) = x mod M and f(i) =
i ∗ hash2(x)
and hash2(x) = 13 − (x mod 7).

I need to INSERT the keys 27, 22, 16, 26, 47, 12, 42, 3 (in this order).
The set is the size of 10

This is what i have so far:
0 []
1 []
2 [22]
3 []
4 []
5 []
6 [16]
7 [27]
8 []
9 []

I am confused on inserting 26 because it is a double collsion….Can anyone explain how to do it and what is going on?

  • 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-26T21:29:19+00:00Added an answer on May 26, 2026 at 9:29 pm

    Running the risk of showing my ignorance, how is i and M defined? I would guess M to be equal to size and would have guessed i to be a counter for number of insertions, but that wouldn’t add up to your output. My implementation however does not collide on 26 but on 42, which means it used more than half the keyspace before getting a collision.


    But then I realised specifying i like that would make the position dependant on insertion order.

    At that point I had already answered but panicked and removed it, can’t look stupid on the Internet, the Internet never forgets. But then I started thinking that maybe I had the wrong idea about the hashing, maybe the numbers are not separate units but part of something that is hashed as a whole, and then the order dependence is correct.

    Could someone improve on my wild guesswork?


    Ok, lets unroll this then.

    hash(x) = x % M
    hash2(x) = 13 - (x % 7)
    f(i) = i * hash2(x)
    hi(x) = (hash(x) + f(i)) % M
    

    for: i=0, M=10, x=27

    hash(x) = 27 % 10 -> 7
    hash2(x) = 13 - (27 mod 7) -> 7
    f(i) = 0 * 7 - > 0
    hi(x) = (7 + 0) % 10 -> 7
    

    for: i=1, M=10, x=22

    hash(x) = 22 % 10 -> 2
    hash2(x) = 13 - (22 mod 7) -> 12
    f(i) = 1 * 12 - > 12
    hi(x) = (12 + 12) % 10 -> 4
    

    for: i=2, M=10, x=16

    hash(x) = 16 % 10 -> 6
    hash2(x) = 13 - (16 mod 7) -> 11
    f(i) = 2 * 11 - > 22
    hi(x) = (6 + 22) % 10 -> 8
    

    and so on, as you can see it diverges quite quickly from what you had

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

Sidebar

Related Questions

Looking in this StackOverflow question it uses the following to send emails: System.Net.Mail.SmtpClient Is
This relates to my other question on accessing a REST service that uses forms
This is a question that has been bothering me for sometime. My application uses
(See this question in ServerFault ) I have a Java client that uses Socket
The question An open source program uses CVS for version control. I would like
I know, that this question was created many times, but it is stil open
This question is kind of an add-on to this question In C#, a switch
This question and answer shows how to send a file as a byte array
This question comes on the heels of the question asked here . The email
This question would probably apply equally as well to other languages with C-like multi-line

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.