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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:26:40+00:00 2026-05-18T10:26:40+00:00

I had a weird idea about a hashing function. The problem statement is You

  • 0

I had a weird idea about a hashing function. The problem statement is

You are storing id-numbers of 162
students in a class obtaining n marks
out of 300 in a course (for each n=0,
1, 2, … 300) in a hash table. Devise
the simplest and least collision prone
hash function for this such that the
wasted memory cells also are minimum.
Here, a collision is when two students
scoring n1 and
n2 get the same slot in the
hash table.

One solution can be to use h(n) = (n*5 + 7) % 163 along with chaining. There can be at most 162 distinct marks.

EDIT There can be several standard ways to do this. But I’d like to try my idea and check it (maybe mathematically). It just might have lesser collisions with lesser memory.


Now, here’s the idea I had. I can assume distribution of marks to be gaussian. So, there are more people near the average score and lesser at the extremes.

So, I can have a hash function something like this:

h(n) = 0 (if n<100 || n>200)
h(n) = 1 (if 100<=n<125 || 175<=n<200)
h(n) = 2 (if 125<=n<140 || 160<=n<175)
h(n) = 3 (if 140<=n<160)

For some such conditions (say, k), the hash table will have the least number of collisions and the least amount of space occupied.

Now, this is just a guess.Does something like this make sense?Is there a way to prove this? Or am I wrong somewhere?

  • 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-18T10:26:41+00:00Added an answer on May 18, 2026 at 10:26 am

    What you are doing manually here is called in image processing histogram equalization. I think it makes absolutely sense, because you make sure that statistically all slots are used with the same probability, and so you’re minimizing collisions.

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

Sidebar

Related Questions

I had a very weird problem with precompile header. The linker generates LNK2019: unresolved
Had an interesting discussion with some colleagues about the best scheduling strategies for realtime
I had an idea, if I add a python .py file to my C#
I had to delete all the rows from a log table that contained about
I had the idea of a search engine that would index web items like
I was thinking earlier today about an idea for a small game and stumbled
I have a weird problem that sometimes when I make a change to a
All, I use jgrowl to display certain content ,and i had got this weird
i came across this weird problem and don't seem to find a solution for
Got a weird problem here. I have created a template for a ListBox based

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.