The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [hash-table]

A hash table is a data structure used to implement an associative array (a structure that can map keys to values). It uses a "hash function" to compute an index into an array from which the value can be found.

Filter by
Sorted by
Tagged with
6
votes
2answers
1k views

Hackerrank challenge - Dictionaries and Maps

This is a solution for the Day 8 hackerrank.com challenge. The basic idea of the challenge is to create a mapping of names to phone numbers based on the the given input, and later look up the phone ...
6
votes
2answers
131 views

Unicode-capable symbol table (N-way search tree with hash buckets)

As in my previous question, this module is coupled with its own testing framework. As a symbol-table for a Unicode-capable programming language interpreter, I decided to combine the 3 types of ...
10
votes
3answers
2k views

Yet another hash table in C

Will be very grateful for thoughtful code review. I needed hash table (again) and I wrote one. Code here is here or inline: ...
10
votes
5answers
19k views

Python Hash Table Implementation

I'm attempting to implement a basic hash table in Python using only lists. Any tips would be appreciated (including better hash functions). I intend this to handle collisions with separate chaining. ...
8
votes
3answers
385 views

Calculating effective shop inventories from CSV files

Program purpose The purpose for the program is to create a file containing the effective inventory for each stocked item stored in a collection of shops. Input and algorithm details For clarity, ...
5
votes
2answers
5k views

Function that shortens a String based on a term/abbreviation mapping

I have a function that takes a description as a String and returns a shortened version of the description. The shortening is done by checking if a word matches the ...
4
votes
1answer
932 views

Morse code string - follow-up 2

This is my second follow-up. Major changes made: Use a Map instead of an enum for the Morse characters Added ...
3
votes
1answer
448 views

An intrusive chained Hash Table

I was interested in experimenting with some intrusive versions of common data structures, so I've written this simple chained hash-table using the approach: ...
24
votes
2answers
1k views

Mapping arbitrary Int values to a linear index space

This is part of a growing "primitive" tools collection here on github, and is the initial use-case for the IntArray for review here. Often, when processing data, you encounter unique values that you ...
8
votes
1answer
206 views

Calculating protein mass

This question is part of a series solving the Rosalind challenges. For the previous question in this series, see A sequence of mistakes. The repository with all my up-to-date solutions so far can be ...
7
votes
2answers
2k views

Generic NSMapTable replacement written in Swift

This is my attempt at writing a generic NSMapTable with weak keys and strong values (after your feedback I'll be trying to write Strong-Key/Weak-Value and Weak-Key/...
6
votes
2answers
4k views

The most efficient way to merge two lists in Java

I am looking for a way to merge two files with a list of distinct words, one word per line. I have to create a new txt file that would contain all the words of the first list and all the words from ...
6
votes
0answers
112 views

Bidirectional bijective hash map in C

I have this bidirectional hash map in C for dealing with bijective maps. Each key mapping consists of a primary key and a secondary key, and I can ask the data structure to give me a secondary key ...
4
votes
2answers
303 views

Data Persistence

I was wondering if I could get some feedback on the library I created to persist data online. JitterPushDemo.java ...
4
votes
3answers
9k views

Most common occurrence of an int in an array

I am prepping for a junior level interview in C#. I am hoping I can get some feedback on how to improve my code to print the most common occurrence of an int in an ...
0
votes
4answers
7k views

Finding all integers in an array with odd occurrence

I am doing an interview exercise problem from here. The problem is to find "all numbers that occurred an odd-number of times in an array". Here is my high level psuedo code thinking: Construct a ...
-2
votes
2answers
108 views

Two-letter word dictionary - array index implementation

Here is the code for a two-letter word dictionary (example: aa) using array indexing: ...