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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:51:36+00:00 2026-05-23T04:51:36+00:00

Just trying to understand the linear probing logic. With as hashtable using open addressing,

  • 0

Just trying to understand the linear probing logic.

With as hashtable using open addressing, how can you ever confirm that an element isn’t in the table.

For example, say you had a 10 bucket hashmap.
Suppose you hash a key, and insert it. Now, if element A and B are to be inserted and hash and reduce to the same bucket then element A and B if using a linear probe will likely be next to each other.

Now, just because a bucket is empty, does not seem to mean that an element doesn’t exist in the map. e.g. You search for element B after element A is first removed. First you get an empty bucket where you expect B to be, but you need to probe one more and you’ll find B. It’s really is there. If that logic is correct then won’t you have to search the entire table to confirm whether a key is not there? i.e. O(n) performance everytime.

What I’m saying is, don’t you need to go through the whole map to truly confirm it’s not there?

With a separate chaining approach to hashmap’s that problem doesn’t exist.

For example:
enter image description here

If John Smith is deleted, and we try to locate Sandra Dee.

Or with linear addressing are you meant to move elements around so that there are no holes as such. i.e. If John Smith is deleted should elements from 152 to 154 be shifted back one place? It don’t really see that in the description but that might make some sense. Except if ted baker hashed to 154 and not 153 as described. Requires a bit more work than I thought.

Might just go with a simple linked list at each bucket.

  • 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-23T04:51:37+00:00Added an answer on May 23, 2026 at 4:51 am

    In the absolute worst case, yes the algorithm to determine whether or not some item is in the table is O(n). However, this will never happen in a properly managed hash table.

    When an item is removed, a tombstone should be placed at the table slot that it was removed from. The tombstone is simply some data to indicate that there used to be an element there, but it has been removed. In this way, every time you search for an element, you must follow whatever probe sequence you are using until you find a slot that is empty. If a slot is empty you have completed the probe sequence for that hash value and know that it will not be at any other place in the table.

    The only way that you would have to search through every slot in the probe sequence is if there are no empty slots in the probe sequence. Since you should always aim for a hash table to be about half empty, this should not happen.

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

Sidebar

Related Questions

No related questions found

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.