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 (3)

0
votes
0answers
12 views

Hashmap in Java [on hold]

Im trying to use a HashMap to do a project where i read in a list of jumbled words and a file of actual dictionary words and use a HashMap to find all the words that match in the jumbled words file an ...
1
vote
2answers
91 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
14 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
75 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
23 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 ...
1
vote
0answers
125 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 ...
7
votes
0answers
116 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
97 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 ...
4
votes
2answers
93 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
70 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
61 views
3
votes
2answers
66 views

“Invert” a JavaScript object hash whose values are arrays to produce a new object hash with keys as the elements of those original value vectors

Background lodash and underscore have an invert function that takes an object hash and converts it to a new one, which has keys as the input object's values and ...
0
votes
1answer
45 views

log(n) “sort by value” Map<K, V>?

I've read so much arguing about "sort by value maps". Well, I wrote the following log(n) sort by value Map . And, by the way, a real Map , does not allow duplicate keys. Many of the maps I googled ...
0
votes
1answer
20 views

Search strings within a list from strings within a dictionary with the least complexity

I have the following input: newValue = [['men', 'John Doe,Chris perry'], ['women', 'Mary,Anne,Lita']] - list within list ...
3
votes
2answers
271 views

Data Persistence

I was wondering if I could get some feedback on the library I created to persist data online. JitterPushDemo.java ...
3
votes
1answer
60 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: ...
1
vote
0answers
12 views

Universal nested get/set for trees in Python

Based on this source, I've made the following universal get / set function, to make it possible to work on OrderedDict trees for example. ...
4
votes
2answers
195 views

Simple Chained HashMap

I am very inexperienced at C++. I wrote a Hash Map which uses chaining for collision resolution. I intentionally did not use smart-pointers, as the objective of this was to learn and showcase. I ...
6
votes
0answers
63 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 ...
0
votes
3answers
111 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 ...
1
vote
1answer
86 views

Thread Safe Objects in CSharp - ConcurrentDictionary

I'm using ConcurrentDictionary to hold the records.. I'm reading files from the local system in parallel, to speed up the process. Sample 1: ...
4
votes
1answer
74 views

Dictionary with restricted keys

I'm currently building some software that works with systemd unit files, and I've been trying to improve how we construct the unit files. This is all running in Python 3.4 This first block is the ...
7
votes
3answers
136 views

Replace keys in values with key->values from same dictionary

I have a dictionary whose values may contain keys that are already in the dictionary. What we are actually talking about are parameters. Sometimes a parameter is defined by a number plus another ...
2
votes
1answer
52 views

LRU Cache Design using LinkedHashMap

This is a follow-on qestion from: LRU cache design Revised Implementation ...
5
votes
2answers
90 views

Optimizing this method (HashSet.RemoveWhere performance issue)

I have the following method: ...
6
votes
0answers
57 views

BiDirectional Dictionary (and its Mutable friend can come too)

I've attempted to implement a 1-to-1 dictionary in Objective-C. I'm probably missing some convenient methods that one might commonly want to use. These are both declared in the same ...
1
vote
1answer
42 views

Simplifying the code with same list comprehensions

I have such method where: primary_images is dict, additional is ...
2
votes
1answer
131 views

Hash table with double hashing

I writing a hash table with double hashing. This code works ONLY with ASCII text files and finding the number of occurrences of each word in input file! Please point out mistakes and shortcomings. ...
2
votes
1answer
46 views

Use of dictionary for file-saving function

I have the following function: ...
5
votes
2answers
78 views

VSTO Write Dictionary To Range Extension Method

I was hoping to receive some criticism on this block of code. I wrote it to write the contents of a dictionary to excel range in VSTO. It works well. I am interested to see how people could improve ...
1
vote
1answer
44 views

Filtering stocks by dividend yield

I have a dict of stock tickers (KEY) and a data point (VALUE; e.g. dividend yield). I want to know which tickers have a value between a specified min and max value. Given ...
5
votes
3answers
159 views

Optimize huge text file search

I have several huge 100MB text files that I need to scan through to pick out certain frame numbers which relate to a specific log packet of interest. My plan was to scan for these frame numbers and ...
3
votes
1answer
67 views

Hashing a struct in C

I'm trying to learn how chained hashing works, but can't get any further than this. I think hashing works, but after finishing this little program, someone told me that what I have created so far has ...
1
vote
1answer
59 views

Handling overwriting of unique Dictionary values

I am working in C# to write a scheduling application for operations in a factory. I have a custom class Workday, with properties to represent a ...
1
vote
0answers
104 views

Hash Table Implemented by Javascript

I recently tried to implement a simple hash table using Javascript. Could anyone help me review my implementation? ...
2
votes
2answers
128 views

Counting a cycle

An interview question I got - Each element of an int array points to the another element, eventually creating a cycle. Starting at ...
2
votes
1answer
54 views

Iterating and fetching values from dictionary

Here is my dictionary: c_result1 = {"1": {"time": "89.46%"}, "2": {"date": "10.54%"}} c_result2 = {"1": {"money": "89.46%"}, "2": {"finance": "10.54%"}} I want ...
3
votes
2answers
68 views

Ruby hashes of status counts

I have a method that takes a model object, reads through its children and returns a hash of status counts. It should only return a count on a status if one exists. This method works, but I was ...
0
votes
1answer
71 views

A double mapped cache with WeakReferences for second key type

I needed a way to cache a large number of objects with two different types of keys. In my case: A String key represents my object in a serialized form. This way ...
2
votes
1answer
81 views

Determining the existence of string Intersections

Problem: Given 2 strings, consider all the substrings within them of length len. Len will be 1 or more. Returns true if there are any such substrings which appear in both strings. Compute ...
1
vote
1answer
86 views

Getting key-value from Object in Java

This takes a collection of Objects from JavaScript and puts them into a Java project. How can I improve this code? What's the best solution? ...
4
votes
2answers
178 views

Map String to list of string

Input: String : Title; List Tags Problem statement: Need to map title to tags, e.g. title is "china man japan beijing bell" and tags are ...
4
votes
1answer
170 views

Follow-up 2 to Morse Code String

This is my second follow-up. Major changes made: Use a Map instead of an enum for the Morse Characters Added ...
8
votes
3answers
384 views

Recursive Insertion in Hash Table (Linear Probing)

I was practicing implementing a hash function. I tried to use linear probing to insert in hash table. The insertion is working alright but I am not satisfied with the recursion. It doesn't feel like ...
4
votes
0answers
69 views

Finding Facebook Friends on app, and not on app

This code gets all of a user's Facebook friends who use our app and returns a dictionary with keys that are their id's in our database and values that are a default connection level. The code should ...
0
votes
2answers
168 views

Split a Map into sublists

I may get a Map of many many items that needs to be requested to an API. In order to improve performance, I thought about splitting that list into smaller ...
0
votes
4answers
197 views

Merge two dict in separate list by id

I have following data structure >>> a = [{'id': 1, 'name': 'a'}, {'id': 2, 'name': 'b'}] >>> b = [{'id': 1, 'age': 12}, {'id': 2, 'age': 21}] I ...
4
votes
1answer
59 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 ...
6
votes
2answers
450 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 ...
5
votes
2answers
152 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? ...