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)

1
vote
1answer
39 views

Mapping yielding lots of warnings in use

Recently, I wrote a C header file that defines a new type called HashMap that allows for the storage of key/value pairs. I am just learning about the wonders of ...
5
votes
2answers
177 views

HashTable implementation

I have been trying to implement the Hash Table function in Java and here is what I came up with. I would just like to get an opinion on this work. Would there be a better way or any improvement to ...
1
vote
0answers
17 views

HashTable function implementation [duplicate]

I have been trying to implement the Hash Table function in Java and here is what I came up with. I would just like to get an opinion on this work. Would there be a better way or any improvement to ...
5
votes
2answers
81 views

Hash Binary Tree Map

I made a map based on a binary tree ordered by hashcodes, with collisions fixed with equals(). Are there any improvements I could make? ...
5
votes
1answer
38 views

Regex matching keys in a Dictionary

I have extended this class http://wiki.unity3d.com/index.php/CSharpMessenger_Extended to accept strings containing wildcards as eventTypes, therefore I am able to ...
1
vote
1answer
30 views

Spatial hash triangles from multiple assets

I am implementing the spatial hashing algorithm described in Optimized Spatial Hashing for Collision Detection of Deformable Objects with a few adjustments, the largest one being that each bucket in ...
3
votes
0answers
28 views

Weeding out triangles for triangle-triangle collision detection using a spatial hash

I am implementing a multi-phase collision detection system whose final collision check is checking the triangles of one shape against those of another. As the number of triangle-triangle comparisons ...
3
votes
1answer
52 views

Finding average word length in a given year

I have written a function which takes the year in question and words as a data which is a dictionary that maps words to the list of year/count. Now I am wondering how I can improve the code that I ...
10
votes
4answers
514 views

Strategy pattern - design hash table

My programming skill has gotten rusty, so I would like to elicit constructive criticism that can make me write code better. I know the standard design is to use templates, and even obtain the hash ...
2
votes
2answers
84 views

Swift complexities with Dictionary

I have been trying to learn the various aspects of the languages I know so far to do the Daily Challenges in reddit (/r/DailyProgrammer). The one which I am working on just now asks for an ...
1
vote
1answer
57 views

Flattening a HashMap of (String → ArrayList) to an ArrayList

I have one HashMap<String, ArrayList<String>> and I want to concatenate a key with every item in its ArrayList. ...
-1
votes
2answers
67 views

Sorting array with respect to two properties

I'm sorting with respect to Width and Length. However, Width has the significance ...
5
votes
1answer
65 views

Dictionary Key look up with variable length inputs

I am decoding GS1 barcodes and need to match up application identifiers with relevant data about them. ...
4
votes
2answers
74 views

Convert Object Keys according to Table/Map object

I have implemented a recursive function that converts an object's keys according to another lookup table/map. You are able to convert back and forth using the 3rd ...
2
votes
2answers
77 views

Make a dict class from scratch in Python

Here's the API my teacher assigned: and here is what I came up with: ...
1
vote
0answers
28 views

Python Multiprocess Dictionary Selector [closed]

I am attempting to select devices via telnet based on a key I get from pinging the telnet device. Basically it selects to use only the devices with the given key. I am running into issues when a ...
5
votes
3answers
111 views

Map with different types for values

I am trying to implements a map (that can work as a cache) that has strings as keys and values of different types. In my real case once set the key/values in the map will not change. I used these ...
4
votes
2answers
62 views

Chained hash table implementation

While reading a data structure book, I have implemented a chained hash table. I want to share the code with you and get your opinion about it. chained_hash_table.h ...
4
votes
2answers
79 views

Fetch plist file

I have a plist file with many nested dictionaries inside of it, and I wanna fetch them all to my code. Isn't there any more efficient way to do that than nested for-loops? ...
3
votes
1answer
31 views

Generating a complicated data structure in a more efficient manner

I need to convert some CSV data into a format recognizable by some old script my work uses. Changing the format is pretty much out of the question. So I've written this: ...
8
votes
1answer
233 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 ...
9
votes
2answers
288 views

Implementation of fixed size hash map

I'm trying to brush up on my algorithms and data structures and wrote a fixed sized hash map assuming both key and value will be only integers. This is a significant simplification of the real case ...
5
votes
1answer
46 views

Python DictionaryTagger class takes too long to initialize

With big inspiration from code from different webpages, I have created this DictionaryTagger. My problem is that it takes around 2 sec. to initialize the taggers / ...
2
votes
1answer
39 views

Print dict with varying-length lists

Is there a shorter way of taking a dict with varying length lists and printing it to screen? Shortcomings of this method also include that values which aren't lists are printed as letters separated by ...
2
votes
2answers
51 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: ...
2
votes
1answer
40 views

Iterate over items in a set of dicts

I'm using the following code to initialise 8 I/O-ports (i.e. GPIO pins on a Raspberry Pi). That's 4 x 2 pins, each duo controls a switch, A to D, and each duo consists of a pin for On and a pin for ...
1
vote
2answers
81 views

Code to generate a dictionary from two lists

I created a script to perform a union on 2 lists: keys and words. I needed to create a dictionary from them. If there are more keys than words, missing words are replaced with "None". Any excess words ...
3
votes
1answer
101 views

Read from csv file, transform to dictionnary

First of all, here's the code I'm working on: ...
4
votes
2answers
113 views

Traversing and printing complex Dictionary types (Scripting.Dictionary) - Dictionary inside of a Dictionary

Based on this SO post - also reposted on vba4all.com with a few more details and explanations. Please notice there currently is no error handling whatsoever as I didn't analyse and consider any traps ...
2
votes
1answer
61 views

Fuzzy matching dict keys

What do you think of this idea? It's supposed to be a dict that makes a reasonable guess at the key you were trying to access for getters and deleters. Setters should be untouched. Similar to how ...
2
votes
1answer
40 views

Mapping object values from one object to another

I have an object called defaultOptions and a function that accepts as an argument an object called newValues meant to override ...
4
votes
2answers
202 views

Performance of hashmap-based session object

Unfortunately, I can't use the Tomcat session for storing the key/value pairs for each user (restricted because it's an IVR domain-based project). But I need the same functionality like a ...
1
vote
0answers
54 views

Using URLs and RegEx for web scraper from a dictionary [closed]

I have dozens of functions which GET/POST to some URLs and extract data using RegEx. The URLs and regular expressions were hard-coded earlier but now I moved all of them to a dictionary. I then saw ...
4
votes
4answers
1k views

Simple implementation of HashMap

I have implemented a HashMap which supports insertions of integer key value pairs. The approach uses an array for simplicity and uses a standard hash function. ...
11
votes
2answers
398 views

Object key-value map reversal

I have implemented functions that will let me reverse a one-to-many value 'Map', that is a plain JavaScript object. For example, ...
2
votes
1answer
53 views

A function to convert FASTA .txt to a dictionary

I'd like feedback on my function to convert FASTA data to a dictionary in Python. Here's an example of FASTA text: ...
6
votes
3answers
161 views

Convert dict entries to sets and lists

Can you please tell me if there is a better way to do this? ...
11
votes
4answers
309 views

Using a Dictionary to retrieve BOOL values

I have some values pulled from a web service giving me a bool value for a key. I did it this way, but feel like it is repeating without need. How can I refactor this? Please note that the key on ...
3
votes
1answer
134 views

Creating a fast Android dictionary (word counts)

This is a follow-up of my question here: I am currently working on an application for various statistics. One task is to analyse a good amount of sentences for their word counts. The specifications ...
3
votes
1answer
78 views

Merging values with lists as flat-lists

I'm merging dictionaries together in series. Each one may/may not have lists as values. I'd like to merge indefinitely and, have the final merged dictionary contain only flat lists as values. Any ...
3
votes
0answers
157 views

Multi-dictionary API using Python Flask-RESTful

I'm working on a simple online dictionary tool, using Python Flask-RESTful as the RESTful API backend. The dictionary tool is modular, it can handle multiple dictionaries, implemented as independent ...
2
votes
1answer
69 views

A module to display, update and save a dictionary as .csv v2.0

I'd like feedback on my revised code after my previous question. The goal is to create a module which can display, update, save dictionaries as .csv files. I'll use this in another program to update ...
7
votes
1answer
92 views

A simple dictionary tool, extensible with plugins

I'm working on a simple dictionary tool, with a base class that can be extended by plugins to represent different dictionaries. The base class does most of the heavy lifting: it keeps the index of all ...
3
votes
3answers
204 views

A program to display, update and save a dictionary as .csv

I'm now looking for feedback on v2.0 of this program instead. I'd like some feedback about my code. What bad habits do I have? What advice could help me write more Pythonic? I'm trying to write a ...
5
votes
2answers
146 views

Family finances - tracking and reporting

I am looking for clean way to accumulate amounts within a input dataset. In this example, there are 18 rows of data, and the output is a 3 rows of data, accumulated by Key, by ExpenseType. My ...
4
votes
3answers
657 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
130 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 ...
7
votes
2answers
358 views

Dictionary of attributes and values

In the code below, I have a dictionary of attributes and values. I am checking to see if the value if an attribute is True, and if so adding the attribute to a list for later processing (it becomes ...
0
votes
1answer
54 views

Performance issue with conditionally removing keys from a dictionary [closed]

I'm new to Python (2.7 Spyder). My code takes a long time to execute, and seems overly complicated. I'd like to use the range function but it isn't behaving as expected so, I'm using a comparison of ...
1
vote
1answer
80 views

Convert 2D list to dict of list of index

I have a 2D list like this: ...