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

The Archive Base Latest Questions

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

I have read about hashtable and open adrdessing. If you want to insert the

  • 0

I have read about hashtable and open adrdessing. If you want to insert the keys: 18,32,44 in an hashtable with size 13:

18 gets index 5 (18 modulus 13 = 5)
32 gets index 6 (32 modulus 13 = 6)
44 gets index 5 (44 modulus 13 = 5)

You’ll get a collision because there are already something on index 5.

If you use linear probing you’ll do hashfunction = (key+i) modulus N where i = 0,1,2.. until you find an empty place in the hashtable. Then 44 will get be inserted at index 7.

What if you delete 32, and then you want to delete 44. You start by looking at hashfunction(44)=5 – that was not 44, then hashfunction(44 + 1) = 6 – that is empty. Then you might think that 44 is gone. How do you mark a place in the hashtable, that the place is not really empty, but does not contain a key, and that you should keep looking for 44 at the next index?

If you then need to insert another key at index 6 then the key just overwrites the “mark” in the hashtable.

What could you use to mark an index – saying here has been an key, but has been deleted – so you continue to look at next index? You can’t just write null or 0 because then either you think the key has been deleted (null) or that an key with value 0 has overwritten 44.

  • 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-26T21:27:18+00:00Added an answer on May 26, 2026 at 9:27 pm

    One way to handle hash tables using open addressing is to use state marks: EMPTY, OCCUPIED and DELETED. Note that there’s an important distinction between EMPTY, which means the position has never been used and DELETED, which means it was used but got deleted.

    When a value gets removed, the slot is marked as DELETED, not EMPTY. When you try to retrieve a value, you’ll probe until you find a slot that’s mark EMPTY; eg: you consider DELETED slots to be the same as OCCUPIED. Note that insertion can ignore this distinction – you can insert into a DELETED or EMPTY slot.

    The question is tagged Java, which is a bit misleading because Java (or at least Oracle’s implementation of it) does not use open addressing. Open addressing gets specially problematic when the load factor gets high, which causes hash collisions to occur much more often:

    enter image description here

    As you can see, there’s a dramatic performance drop near the 0.7 mark. Most hashtables get resized once their load factor gets past a certain constant factor. Java for example doubles the size of its HashMap when the load factor gets past 0.75.

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

Sidebar

Related Questions

I have read about REPLACE and INSERT ON DUPLICATE key queries, and while I
I have read about partial methods in the latest C# language specification , so
I have read about session fixation and from what I understand it forces a
I have read about LDAP on wikipedia and I kind of understand what it
I have read about the push technologies recently. Using it real-time data streaming is
I have read about dynamically loading your class files when needed in a function
I recall I have read about a parser which you just have to feed
I am using VS2008 to develop a WinForms 2.0 application. I have read about
I have read this post about how to test private methods. I usually do
I have read several documentations about building custom ErrorHandler (by inheriting from IErrorHandler). Unfortunately,

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.