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

2
votes
1answer
77 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
72 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
138 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
43 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
77 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 ...
9
votes
2answers
169 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
227 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
148 views

Max depth of tree when all parent pointers are provided

Request for optimization, good practices, recommendations. ...
5
votes
2answers
1k 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
79 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
4k 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
309 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 ...
0
votes
0answers
67 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
276 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
135 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
89 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
961 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 ...
6
votes
2answers
5k 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
211 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
523 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 ...