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.

learn more… | top users | synonyms

8
votes
1answer
101 views

Dictionary (with silly hash)

Based on this question (but fixed so it can run). I have kept the code as close to the original as possible. I have Marked all the changes with Loki (should be easy to spot). Code here is written in ...
-3
votes
0answers
48 views

Hashing function and Dictionary [on hold]

I have been trying to fully implement my hashing table, but I don't really understand exactly how the code works. I have my header file setup fine, I am just missing implementing the following: ...
2
votes
2answers
47 views

Get ruby Hash#each to return a built hash

I'm golfing some code while waiting for a coworker, and I shortened a function to this: ...
4
votes
3answers
309 views

Dictionary load function using hash table

This loads a dictionary text file into memory to be used as part of a spell checker. It's part of a larger program, but I wanted general comments so I can clean it up further. ...
10
votes
1answer
110 views

Object pool implementation

Below is my implementation of a pool. It is based on a hash table and supports using strong, soft or weak references to store objects. At the start there is a builder class to configure and create ...
2
votes
1answer
111 views

How can I optimize my insert function for the cuckoo hash table?

I'm working on class for a hash table where collisions are corrected using cuckoo hashing, I had difficulty writing the insert function, the function is supposed to insert the key if the ...
2
votes
3answers
80 views

How can I optimize this hash string function?

I'm writing a function which gets two strings and a number k as an input, and outputs a string with length k which is present in ...
7
votes
2answers
522 views

Java implementation of spell-checking algorithm

This little program was written for an assignment in a data structures and algorithms class. This is my first post here, and I understand that I shouldn't post the entire assignment, so in lieu of ...
2
votes
1answer
46 views

Implementation of the undef function

Write a function undef that will remove a name and a definition from the maintained by lookup and ...
2
votes
0answers
152 views

numpy array as quasi-hash table

Motivation: I have a large number of large read-only dicts with large string keys mapped to tuples of two floats. They are taking up a large amount of heap space. Proposed solution: a 3xn numpy ...
10
votes
2answers
209 views

Cash Register Kata

The Setup This kata is a spin on the old backpack problem. Please give feedback on both the kata itself as well as my solution. I'm not sure if the kata needs to lead the student more or if this is a ...
4
votes
3answers
391 views

Find the longest unique string in the input list

Given a list, find the longest non-repeating (in other words I mean unique) string in the input list. Looking for code review, pointers on best practices, optimizations etc. ...
1
vote
1answer
176 views

Max depth of tree when all parent pointers are provided

Request for optimization, good practices, recommendations. ...
5
votes
2answers
2k views

Splitting a text file into paragraphs and words

I'm iterating through a number of text files, trying to locate all carriage-returns, and individually save the text between carriage-returns. I get the index numbers of all carriage-returns, but I ...
5
votes
1answer
101 views

Optimize text to ascii lookup map and scalability

Is there a more optimal way of retrieving the character for the letter? I would assume that I would just replace my Entry set loop with another map, but I do not want to bloat the code, because it ...
8
votes
2answers
5k views

Perfect Hashing Implementation

I'm building a hash table for this problem: Implement a class for storing a set of integers: ...
0
votes
1answer
419 views

Fast hash table based set of pointers

I am trying to make a very fast hash table based set of pointers. It is supposed to be as fast as possible, not conforming to standard C++ at times. This is always marked in the code. Collisions are ...
1
vote
0answers
74 views

Creating an updating hash table

I'm not sure if this implementation is good enough. The function takes a vector of 1 million chars and creates a table of the sequences that pass before the next occurrence of itself. Some questions ...
5
votes
2answers
290 views

Hash Table: adding and finding functions

I made this function to teach myself about hash tables. Any ideas? I commented out free(addition) because it was giving me a compiler error, but I need to figure ...
1
vote
2answers
146 views

Fast integer handling

Each data structure has it's own time complexities. The biggest one that jumps out at you is the hash table. The average times for Insertion, Deletion and Searching are all O(1). But it's really ...
4
votes
1answer
90 views

Object map in JavaScript

I want to make a map object that key is object. But, JavaScript only allows string as a hash key. (at least before ECMAScript6 comes?) So, I tried to write auxiliary functions to emulate, hash-ish ...
5
votes
2answers
1k views

HashTable - separate chaining collision in C++

I'm trying to implement a HashTable. In fact, I want a HashSet with Persons that have a name and a phoneNumber, both string. I understood the theory with collisions and everything but I don't know how ...
7
votes
2answers
7k views

Hash table implementation in Java

For class, I was asked to write a (linear probing) hash table in Java. (I was also asked to write a linear-chaining hash table, which is why I named this one HashtableB as opposed to just Hashtable.) ...
7
votes
3answers
2k views

Two Key HashMap

Background Would like to create a two-key map that is fairly generic. In the existing system, there are a number of ways to name a parameter for a report. Rather than re-writing each report (too much ...
2
votes
1answer
240 views

Simplify complex hash-table manipulations in Common Lisp

I'm trying to write a simple triplestore in Common Lisp that will store triples in the form subject-predicate-object. The code is inspired by the book "Programming the Semantic Web". ...
3
votes
1answer
678 views

Hash table using open-addressing with linear probing

I've written a hash-table implementation. This is the first time I've written such code. The hash-table uses open-addressing with linear probing. The hash function is still subject to change as I ...