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)

2
votes
1answer
27 views

Chained hash table implementation to store student's information

This is my implementation of a Hash Table to store information about a student. Everything seems to work as expected, but I'd like some feedback on the following: Is my style good? Is it easy to ...
6
votes
2answers
75 views

Hash table based key/value dictionary in C++ with murmur hash function, linked list buckets in 200 LOC

hashdic.h -- suggested for direct include or copy paste to your project. ...
5
votes
1answer
33 views

Dump hash in columns

I tried to answer the question "How to print a hash in Perl, such that 3 key value pairs are printed on each line?" like this. As I got an uncommented downvote, I'd like to ask: What's wrong with/How ...
4
votes
1answer
63 views

ConcurrentHashMap Implementation

I have written a simplified version of my own MyConcurrentHashMap. I tried to make use of a Lock[] array for ...
1
vote
3answers
51 views

Faster method for loading a hash table

I'm looking to make my code faster for loading a hash table. Any pointers would be appreciated. Below are my includes, the node def and the loading code. The dictionary loaded could be any *.txt ...
4
votes
1answer
48 views

Concatenating a SoundCloud Playlist Update JSON

I am currently working on an implementation of SoundCloud for a 3rd party iOS app, and as there is no SDK anymore I am doing all my calls via Alamofire. This is what SC expects you to send in your ...
2
votes
0answers
34 views

Passing around and using Python dicts [closed]

I have an Excel file - a profit spreadsheet - which has one tab per product range. The tabs are defined and named, but apart from that, the file contains no data (yet). I wish to use ...
2
votes
1answer
58 views

LRU cache design using dict and doubly linked list

Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set. get(key) - Get the value (will always be positive) of the ...
3
votes
1answer
105 views

A minimal HashTable implementation

For an assignment, I wrote a minimal HashTable implementation (it only supports additions; no deletions). To resolve collisions, it uses Linear Probing (required by the assignment). I'm looking for ...
4
votes
1answer
96 views

Hash table for Coursera's algorithms course

I implemented a hash table for Coursera's Algorithms and Design class. I am looking for feedback on coding style and other improvements. I want to practice C++ coding but I see myself drifting to C ...
2
votes
2answers
47 views

Count of words in a mutable Map

The function should get some text on input and return a map in a following format: ("word1" -> 1, "word2" -> 2 ...) The keys are words from text and the ...
0
votes
0answers
38 views

Hash table with “Time To Live” elements

Recently, I got a very interesting task: to realize the hash table that works in multi-process server in common memory, each element of which must have a TTL property. It was suggested to implement ...
3
votes
1answer
100 views

Safely storing Azure Topic clients in concurreny dictionary

I am trying to optimize the usage of TopicClients in my app. The instance is originally covered by interface and passed by IoC, so the IoC will dispose it at the end of the program life cycle. This ...
5
votes
2answers
108 views

Recursively merge dictionaries with generic types in C#

I am looking to implement a method that is capable of merging 2 dictionaries using generics. I've seen several great answers on SO already, but none handle the case of nested dictionaries. As in, what ...
1
vote
1answer
75 views

Reducing the size of JSON objects

I wrote a function to reduce the size of JSON objects that works simply by turning every associative array into an indexed one, and moving each property's name to the first row of the data array ...
1
vote
1answer
229 views

Shakespeare and dictionaries

The following snippet will return a list containing the words in all of the works of Shakespeare: ...
2
votes
2answers
47 views

Python script to read CSVs and regroup it into the data types I need

This code does the following: Read CSV file and determine sub_type based on series_desc. Turn row into dictionaries ...
4
votes
2answers
102 views

Creating a dictionary from two lists

I have working code here which takes two lists and turns them into a dictionary with the first list being the keys and the second being the values. If the keys exceed the values the value "None" will ...
0
votes
2answers
34 views

Comparing two columns in two different rows

I want to go through each line of the a .csv file and compare to see if the first field of line 1 is the same as first field of next line and so on. If it finds a match then I would like to ignore ...
6
votes
2answers
251 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 ...
4
votes
2answers
224 views

Return all words which have their reverse present in a string

Problem Statement: Given a string of words return all words which have their reverse present in the string as ( (word1 , reverseword1 ) , (word2 ,reverseword2) ) Example Case: Input: ...
3
votes
1answer
54 views

Rename subkeys of nested dictionary dynamically

My nested (ordered) dictionary looks like this: ...
2
votes
3answers
45 views

Intersection of subset between two lists of dicts

I want to find the intersection of two lists of dicts. Note that equality—i.e.: what is to appear in the intersection—is given by which keys they must have equal. See the ...
2
votes
2answers
80 views

Scraper for words from Wiktionary

I wrote this code in Java using the Jaunt library. The program scrapes all words from Wiktionary from category "English_uncountable_nouns". And after save each world to text file. I am not sure that ...
4
votes
3answers
128 views

Build a dictionary based on split string

I've written a simple script that takes a string filled with brackets and strings and builds them to a dictionary. Example Input: ...
2
votes
1answer
58 views

Denormalizing an OrderedDict to CSV

Cross post from stackoverflow, as suggested. I have an ordereddict, and I need to store it in CSV file. Input: ...
3
votes
2answers
92 views
1
vote
2answers
57 views

Restructuring nested maps

I am in the process of making an assembler and one of the needed steps is actually getting the opcode from a table. However, the instruction set I'm working on has a handful of different addressing ...
2
votes
2answers
88 views

Add 100 to all values in nested dictionary

I want to change all values in a multidimensional dictionary. I have written this line of code, which does what I want it to do and I am trying to find out if this is the optimal way or just some ...
2
votes
2answers
94 views

Dictionary foreach loop with multiple occurences

A little look on what are Dictionaries: dictWordCounter<string, int> dictWordPercent<string, double> topTwentySeven<string, double> ...
6
votes
2answers
386 views

Convert a string into a dictionary

I have a string like "food | dairy | milk". The string may consist of more or less words. How do I turn it into a dictionary ...
1
vote
2answers
71 views

Inverse mapping of a dictionary

For the below question picked from here: Write make_inverse_dict(d) that returns a new dictionary with the 'inverse' mapping. The 'inverse' mapping of a ...
2
votes
0answers
108 views

A map class based on an AVL tree

Here's an implementation of a class which is similar to std::map, but it's not a complete/identical implementation. I know C pretty well, but am a beginner with ...
4
votes
1answer
91 views

Numerate every item in dict

I have a .json file with a complex structure: dict in a dict, it has no constant structure and is dynamically changed. The goal is to make new dict where the keys are numbers of hierarchy and values ...
4
votes
1answer
96 views

Self Implemented Hash Map Performance

I have written two hash map implementations, one that stores Vertices and one that stores self implemented vectors of Edges. They are all fully functioning, however in my application they are quite ...
5
votes
2answers
73 views

Forming a dictionary where all values are only conditionally set

I have lots of dictionary keys with conditional values, ternary in this case: ...
8
votes
2answers
839 views

Checking for any character common to two strings — Go is 50× slower than Python

I decided to learn Go, knowing Python. My approach is by solving easy problems like this one: You are given two strings, A and B. Find if there is a substring that appears in both A and B. ...
1
vote
2answers
64 views

Data loading Hash Map

I'm trying to improve my code's performance, and I've found an area where the execution time is being significantly increased. I've had a look through the code but I can't see how I can improve it. ...
1
vote
1answer
67 views

Reading two csv files as dictionaries with differing key definitions

My script reads two .csv files and generates one dictionary per .csv file. ...
1
vote
2answers
873 views

Check for null/empty in dictionary

I am doing the following about 10 times with other strings, so the code is duplicated. How can I refactor this? queryWhere is a ...
1
vote
0answers
116 views

Map operation to update data | Hazelcast IMap returns clone object

I have a nested hazelcast distributed map: Map<CountryId, Map<CityCode, Map<data_key,data_value>>> where "data_key" is "population", ...
4
votes
1answer
91 views

String find and replace method optimization

I am trying to find a specific header string from different Maps (LEDES1998Bheaders, LEDES98BIheaders and ...
1
vote
1answer
34 views

Reordering OrderedDict

Goal: create a new OrderedDict instance's keys in such way that keys in the specified order list appear first. If some keys in order list are not present in ...
2
votes
0answers
176 views

A dictionary that allows multiple keys for one value

I'm trying to learn to program on my own with the help of books and the Internet and thought I'd start a project (a sub-project for a project). I want to build a dictionary that allows multiple keys ...
10
votes
0answers
202 views

Making a generic NSMapTable replacement written in Swift thread-safe

This is a follow-up to this question. While discussing some details about the code I posted there, I came upon a problem with thread-safety. After searching and trying different things, I reached a ...
6
votes
2answers
235 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 ...
10
votes
2answers
193 views

Convert a list of dictionaries to a dictionary of dictionaries

I need to convert a list of dictionaries to a dictionary of dictionaries, with a particular item as the new key. This is the way I'm currently doing it: ...
3
votes
2answers
160 views

Simple string hashing algorithm implementation

I thought of a simple way to hash a string. By taking the ASCII decimal value of each character, multiplying it by 10, and adding all of the values computed together for each character in a string. Is ...
2
votes
1answer
67 views