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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T11:32:25+00:00 2026-06-10T11:32:25+00:00

I am implementing a data structure; a double linked list where items are in

  • 0

I am implementing a data structure; a double linked list where items are in range. I want to find whether an item is present or not in O(1). For this, I would like to hash the nodes where the key will be the item & value will be the node.

In Java, there are in built functions to support this kind of feature.

EDIT: In short,i want hashMap kind of thing in C.

What should I do to implement it in C?

  • 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-06-10T11:32:26+00:00Added an answer on June 10, 2026 at 11:32 am

    Create an array called “buckets” that contain the key and value, with an optional pointer to create a linked list.

    When you access the hash table with a key, you process the key with a custom hash function which will return an integer. You then take the modulus of the result and that is the location of your array index or “bucket”. Then you check the unhashed key with the stored key, and if it matches, then you found the right place.

    Otherwise, you’ve had a “collision” and must crawl through the linked list and compare keys until you match. (note some implementations use a binary tree instead of linked list for collisions).

    Check out this fast hash table implementation:

    http://attractivechaos.awardspace.com/khash.h.html

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

Sidebar

Related Questions

For a project I'm working on, I'm implementing a linked-list data-structure, which is based
For a project I'm working on, I'm implementing a linked-list data-structure, which is based
I'm implementing a union-find data structure in C#. The elements must extend the Element
How would one test whether data structure built properly? I'm implementing kind of modified
After implementing the data structure suggested in this thread , I decided to fill
I am implementing an Ordered List data structure in C++ using class templates.For simplicity,
I'm currently implementing a very complex tree structure to allow for near-instant data access,
I'm implementing a search before data entry, to make sure the user is not
I'm having an issue implementing an excel feature I'm after, this is my data
I want to create a data structure that will be parse as a JSON

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.