Questions tagged [dictionary]

A dictionary, in computer science, is a data structure that maps keys to values such that given a key its corresponding value can be efficiently retrieved.

22 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
7
votes
0answers
104 views

Agent-based Immutable Map

I am in the process of removing the last few pieces of mutable state from an F#-based distributed system. Some of the remaining mutable state is a ...
6
votes
0answers
495 views

IndexedArray Class: Uses a Dictionary Keys to Index a 2 Dimensional Array of Values

This class encapsulates a 2D Array and a Scripting Dictionary. Values are add or returned from to the Array using a Key and a ColumnIndex, e.g. ...
6
votes
0answers
2k views

Decode HTML Entities in VBA using regex and dictionary

I receive HTML-encoded text that includes named and numbered entities, and I need the decoded HTML. There were just too many bad solutions for this online. I use regex pattern ...
5
votes
0answers
378 views

Recursive conversion from ExpandoObject to Dictionary<string, object> #2

Because my original question was lacking many details, I have been advised to ask a new question. I will repeat the important parts of the original question and add examples etc to hopefully make it ...
5
votes
0answers
67 views

Elegant way to alter datasets with explicit filters

I would like to write a small helper to filter datasets. Each dataset is a dictionary and some filters I want to apply are common to all the datasets. That my needs, I wrote this following pattern: <...
4
votes
0answers
80 views

General Purpose C Dictionary

I'm trying to create a general purpose C dictionary (as an opaque data type) capable of dynamically allocating basic types (ints, floats, strings and longs) as well as accepting void pointers to ...
3
votes
1answer
52 views

Function for accessing and searching dictionaries using /slashed/paths (like xpath)

So I have some data being returned to me in the form of a deeply nested Dict and I need to parse multiple values from it which may or may not be there. I saw this library (https://github.com/...
3
votes
0answers
111 views

C# code for minimizing the sum of an array by dividing it's elements (repetition allowed) by 2 for k times

The assumption is that k is quite large as compared to no. of elements in the array and division by 2 returns ceiling of the result. Request for your review and suggestions for further improvements ...
3
votes
0answers
1k views

Alternative for VLOOKUP/Index-Match in VBA

I am sharing this function I wrote with the community to provide an alternative to slow VLOOKUP and/or Index-...
2
votes
0answers
32 views

Converts Pandas and Numpy into Dictionary and Converts back to original format for data split

I'm trying to refactor some code so that it does not have so much repetition to it. What I'm trying to do is create an input for a multiple channel/input neural network. The features that are being ...
2
votes
0answers
35 views

Trie to index files and search for them

Basic idea (foo and foa are filenames): ...
2
votes
0answers
60 views

Pythonic way to cast a dictionary into a pd.DataFrame with two columns?

I have a dictionary where for each key, a single value is stored. Say import pandas as pd dd = {'Alice': 40, 'Bob': 50, 'Charlie': 35} Now, I want to ...
2
votes
0answers
3k views

Ordered-by-insertion map

The main problem that I tried to tackle here was trying not to have the erase method to be \$O(n)\$. I kept two data structures: a linked-list of pairs and a map of a key and a pair containing a value ...
2
votes
0answers
48 views

List of lists from file

I'm writing a sub-routine in AppleScript to get text from a file and insert that text in a list of lists forming a dictionary. Text File: a:b c:d e:f Expected ...
1
vote
0answers
56 views

What is the best implementation of a ignore case dictionary In C#

Imagine we have a custom dictionary class which is derived from Dictionary<string, object>. Dictionary is case-insensitive about keys and elements arrange is ...
1
vote
0answers
30 views

Simplifying decision tree when working with map which has two keys and value as a slice

Can this logic not be simplified more, the code works, but it has become too much of a spaghetti. The requirements are that there should always be one connection if possible in ...
1
vote
0answers
392 views

Filling values for nested dictionaries

I have a text file where any name followed with sequence word is considered a dictionary. The task is to go through the keys and values of a particular dictionary, which is already identified, and see ...
1
vote
0answers
89 views

A fast integer key map in Java via a van Emde Boas tree

Introduction The following data structure is a dictionary mapping primitive int values to any value type. Basically, under the hood it is a hash table, where a ...
1
vote
0answers
60 views

Calculating the number of matches for a tuple, a pair of nodes and a mapping

For a current node_pair, this program computes the number of variables matches it has. The matches for a node pair combined with a key are stored in a weight_dictionary with keys for each node pair. ...
1
vote
0answers
54 views

Generate user form fields based on a dictionary that may have nested dictionaries

This piece of code is doing what I need it to do but I'm still not happy with it. Here's the main logic to it: Iterating over a dictionary, I want to treat differently the one item that has the key '...
1
vote
0answers
83 views

Implement “at” lens for Data.Map

I've been working on adding an operation like Data.Lens.At.at to Data.Map. This uses an extremely fast, extremely small, and ...
0
votes
0answers
90 views

Dictionary search: compare many values in a dictionary using keys

What I have: Mainly, a graph consists of 10000 nodes and around 500000 edges. I would like to construct a dictionary where keys are the edges and the value for each edge is an array consists of 0, ...