Skip to main content

Questions tagged [hash-map]

A data structure that uses a hash function to map identifying values, known as keys, to their associated values

6 votes
4 answers
774 views

First C++ project: write a hash set for a specific scenario where I only need inserts and containment checks. This is not AI slop, everything except for the avalanche function is hand written. Please ...
Bananach's user avatar
  • 191
3 votes
2 answers
390 views

I started implementing my own hashmap in C after taking inspiration from Git's hashmap API. As far as I know, the closest thing to templates in C are macros. I've seen that they are used in uthash or ...
Husto's user avatar
  • 103
7 votes
2 answers
1k views

A recent CR exchange led me to dust off and adapt some code I'd written a few years ago. Long, long ago, when core meant ferro-magnetic memory cells, I spent an hour formulating a "simple" ...
user avatar
7 votes
3 answers
1k views

I am a C++ programmer trying to learn C. Please critique my C code here. I am trying to make a small "hash table" that's \$O(n)\$ lookup. But, it is stack-based and so should be no slower ...
ijklr's user avatar
  • 397
7 votes
1 answer
347 views

The following code comes from an intrusive container library I am working on in C23. So far, it works correctly due to extensive testing and sample programs I have written with it. I have implemented ...
Alex Lopez's user avatar
1 vote
2 answers
161 views

I need a code review for my implementation of my multidict in Python. I'm not sure that my method below is implemented the best way: ...
OlRay9497's user avatar
1 vote
1 answer
53 views

I've implemented a separate chaining hash table in C++ and would appreciate any feedback or suggestions for improvement. Code: ...
Nafees Madni's user avatar
5 votes
2 answers
1k views

I'm looking for a mapping data structure, but knowing that the possible values of my keys are small numbers, I would like to trade memory for better performances (for both random access and value ...
Delgan's user avatar
  • 621
3 votes
2 answers
194 views

I'm using pydantic in a project to check file formatting for an object, as well as pylint for linting. Whenever I read a file with an invalid format, I want to raise an exception with a descriptive ...
BobVitorBob's user avatar
-3 votes
1 answer
85 views

I have a dictionary with key - data pairs. My data comes from excel sheets. When I create the dictionary my objects are placed in order by their keys ex. 1 -> data of sheet1, 2 -> data of sheet2 ...
tzoni's user avatar
  • 3
5 votes
1 answer
440 views

I wrote code that implements perfect hash table, according to its description in the book "Introduction to Algorithms by Thomas H Cormen", but the code does not pass time tests in contest. I ...
user avatar
5 votes
0 answers
215 views

The latest version of the Dictionary class presented in this question is available in the VBA-FastDictionary repository under the latest release. Motivation I ...
Cristian Buse's user avatar
4 votes
3 answers
327 views

Problem Statement: Given two sparse vectors, compute their dot product. Implement class SparseVector: SparseVector(nums) Initializes the object with the vector nums dotProduct(vec) Compute the dot ...
Pankaj Kumar's user avatar
6 votes
3 answers
746 views

This program solves the minimum dominating set but it takes an insanely long time to run. In case you do not know, in graph theory, a dominating set for a graph G is a subset D of its vertices, such ...
BeginnerProgrammer6's user avatar

15 30 50 per page
1
2 3 4 5
60