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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:10:06+00:00 2026-05-28T07:10:06+00:00

I started reading about implementing various data structures a few days back, and got

  • 0

I started reading about implementing various data structures a few days back, and got around to hash tables and got stuck on a specific point.

My understanding of how a hash table is implemented:
A key K is passed to a hash function H which returns a hashed version of K, HK. HK should probably be at least a uint32_t to account for collisions, we have an array of size X, the item is stored at the index HK of this array.. but, wouldn’t this require a pre-allocated array of length uint32_t atleast (or whatever the return value of H is)? assuming that we don’t store the data itself within that array, and instead store a ptr to the data, then we’d need an array of ptr_t of length uint32_t.. this seems quite wasteful, on 64bit that would mean memory usage of:
2^32 * 8 = 34359738368 bytes or ~32GB just for the array of ptrs to the data, which is obviously not how its actually implemented in real life..

So what am I missing?

  • 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-28T07:10:07+00:00Added an answer on May 28, 2026 at 7:10 am

    It depends upon the implementation. There are three basic ways this is done:

    1) Small hashes are used. So instead of using a 32-bit hash, say, an 8-bit hash is used.

    2) Multiple levels of hashing are used. So, for example, a 12-bit hash may determine which “bucket” an entry goes in, but a collision only occurs if the full 32-bit hash matches. Each bucket is stored in a linked list or similar structure. (Perhaps one optimized for searching for the full 32-bit hash within it.)

    3) Sparse arrays are used. These are data structures that don’t need to actually store blank spaces for unfilled slots. (In practice, it could be something entirely different such as a tree, but it acts like a sparse array with efficient searching.)

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

Sidebar

Related Questions

We have a bunch of data on S3 (images) but just started reading about
When I first started reading about and learning ruby, I read something about the
I recently started reading about ASP.net MVC and after getting excited about the concept,
When I first started reading about Python, all of the tutorials have you use
I just started programming in C# and was reading about dividing your application /
I have started to learn about python and is currently reading through a script
I just started reading Effective C++ today and got to the point where the
I'm new to iPhone/Objective-C development. I jumped the gun and started reading and implementing
I just started reading about JPA and its implementation in Hibernate. To understand the
I'm new to HTML. When I started reading documentation about lists, I've noticed that

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.