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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:15:15+00:00 2026-05-13T15:15:15+00:00

I am stuck trying to figure out how to do string hashing with linear

  • 0

I am stuck trying to figure out how to do string hashing with linear probing.

Basically, the idea is to hash every string from a dictionary (90000 words), and retrieve anagrams of selected words.

Here’s what I did:

  1. created a hash table 2*90000 in size

  2. using a simple hash function, I hash each word from the dictionary, get a value

  3. check if that hash table index is empty, if it is, assign the value, if not, generate a new hash value.

  4. after every word is in the hash table, and I perform a search

  5. the search word will receive a hash value after the hash function, and it will be checked whether that value exists in the hash table or not.

  6. if it exists, it will compare the string using permutations. if the match is true, it will output it. if not, it will keep looking using a new hash value.

problem is, the whole process is extremely slow… it indexes fine, but searching takes REALLY long time.

I am out of ideas on how to make this faster..

Thank you for your time reading this.

  • 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-13T15:15:15+00:00Added an answer on May 13, 2026 at 3:15 pm

    Put all the letters in alphabetical order first, then hash the result with any hashing algorithm you please (crc32, md5sum, sha1, count the vowels, anything… though counting the vowels will lead to a less-efficient solution), and store the word as a leaf node to that hash entry (in a linked list, obviously) — do a mod(x) on the hash result to limit the buckets to 2^x.

    Then, when you go to find an anagram, do the exact same “insert” procedure on your test word: alphabetize the letters, then run it through your same hash function. Then for each leaf node, compare the alphabetized letter list with the saved word’s alphabetized list. Each match is an anagram.

    (I normally don’t like to give homework help, but this one was too tempting. Now I kind of want to go write a fun little program to find all the anagrams in a given dictionary.)

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

Sidebar

Related Questions

I've been stuck trying to figure out why a counter cache on my (parent)
I'm stuck at the moment trying to figure out a method of inserting into
I am trying to figure out how many times a string occurs in a
I'm a little stuck on trying to figure this one out, I think I
I'm stuck trying to figure out if this is possible. Using the blog example
I'm new to pattern matching, having finally figured it out. I am stuck trying
I have progressed with my app but I am stuck with trying to figure
I'm really stuck trying to find out how to force a programmatic refresh of
I've been trying to figure out why the following code is not generating any
I've been trying to figure out the best way to model this entity, and

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.