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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T07:50:56+00:00 2026-05-14T07:50:56+00:00

Right now my hash tables count the number of every element inserted into the

  • 0

Right now my hash tables count the number of every element inserted into the hash table. I use this count, with the total hash table size, to calculate the load factor and when it reaches like 70%, I rehash it.

I was thinking that maybe I should only count the inserted elements with fills an empty slot instead of all of them. Cause the collision method I’m using is separate chaining. The factor load keeps increasing but if there can be a few collisions leaving lots of empty slots on the hash table.

You are probably thinking that if I have that many collisions, maybe I’m not using the best hashing method. But that’s not the point, I’m using one of the know hashing algorithms out there, I tested 3 of them on my sample data and selected the one who produced less collisions.

My question still remains. Should I keep counting every element inserted, or just the ones that fill an empty slot in the Hash Table?

  • 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-14T07:50:57+00:00Added an answer on May 14, 2026 at 7:50 am

    Rehashing is intended to reduce the likelihood of collisions, so systematically ignoring collisions to decide when to rehash seems self-defeating.

    Best might be if you kept with each entry the original full hash value (a collision of course is instead determined by the hash modulo your current size) and counted only the collisions that are due to the modulo operation — implicitly acknowledging that if a collision is due to identical full hash values for different items, there’s nothing rehashing can do to help (unless by “rehashing” you also imply switching to a different hash function, but it doesn’t look like that’s what you mean here;-).

    Keeping the full hash values also means cheaper rehashing since you don’t need to run the hash function again (how relevant is that depends on how costly your hash function is to compute, of course).

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

Sidebar

Related Questions

Right now when I run this it keeps clicking on the same button every
Right now I have 3 tables: User, Roles, and User_Roles for the many-to-many association.
Right now on my (beta) site i have a table called user data which
I'm using Boost's implementation of a hash map in a project right now, and
Lately im trying to use jquery more often and right now im having some
I'm a complete JavaScript noob. I am using this right now: $(function() { $(#tabs).tabs({
Right now, I have many python files. Each has many functions. I'm passing hash
Right now I have an upload field while uploads files to the server. The
Right now, I have: RewriteRule ^([^/\.]+)?$ index.php?id=$1 [L] to match any username at the
Right now, I've just some code which fetches the picture from the URL directly.

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.