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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:35:04+00:00 2026-05-27T06:35:04+00:00

What are prefix hash functions used for? I have created chaining, quadratic, and linear

  • 0

What are prefix hash functions used for? I have created chaining, quadratic, and linear hash tables. I was given simples, prefix, and full-length hash methods which i am not sure what they are used for??

Here is the code:

int HashTable_qp::preHash(string & key, int tableSize )
{
    string pad = "AA";
    //some words in the input are less than 3 letters
    //I choose to pad the string with A because all padded characters 
    //have same ascii val, which is low, and will hopefully alter the results less
    if (key.length() < 3)
    {
        key.append(pad);
    }
    return ( key[0] + 27 * key[1] + 729 * key[2] ) % tableSize;
}

collision detection:

while(i != DataArray.size())
{
    tStart = clock();

    if(QuadraticProbingHT.preHash(DataArray[i],101) == QuadraticProbingHT.preHash(DataArray[i],101) )
    {
        collision_count++;
    }
    tStop = clock();
    total_c += tStop - tStart;
    i++;
}
  • 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-27T06:35:05+00:00Added an answer on May 27, 2026 at 6:35 am

    A prefix hash hashes a string by its first few characters (the prefix).

    Note that in the implementation you give, it hashes a string using the first three characters (if existent; it pads with AA if necessary). Thus, ass and associate has the same hash value under this specific prefix hash.

    A full-length hash uses every character in the string to determine the hash value.

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

Sidebar

Related Questions

So if I have to choose between a hash table or a prefix tree
I have a prefix trie. What is the recommended schema for representing this structure
I have 4 tables (appointed, class, elected, status) that I want to cross reference
Find the first covering prefix of a given array. A non-empty zero-indexed array A
I have a hash being posted to my Rails app that looks like this:
Do you prefix each field in a table with abbreviated table name? Example: Table:
How can I prefix bound values in TextBlock controls in a StackPanel without using
I've had an app doing prefix searches for a while. Recently the index size
I want to store a URL prefix in an Windows environment variable. The ampersands
Is there a way to set the prefix on the Signature of a Signed

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.