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.

Filter by
Sorted by
Tagged with
8
votes
1answer
3k views

Dictionary<TKey, TValue> Implementation

This class encapsulates a List<KeyValuePair> (see List<T> implementation here, and ...
4
votes
2answers
242 views

Genericizing PropertyValues

This should be the last iteration for this code. Does this approach make sense or am I heading down the wrong path? The only thing I can see to make this better is to genericize the ...
6
votes
0answers
375 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. ...
7
votes
2answers
7k 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 ...
6
votes
2answers
131 views

Unicode-capable symbol table (N-way search tree with hash buckets)

As in my previous question, this module is coupled with its own testing framework. As a symbol-table for a Unicode-capable programming language interpreter, I decided to combine the 3 types of ...
4
votes
1answer
67 views

Preparing tabular data to be sent as json

I query a database and pass the data for processing as a DataTable. After all computations (grouping, filtering, formatting etc.) I need to send it to a Web-Service ...
12
votes
1answer
6k views

Simple trie implementation in JavaScript

After experimenting with a sorted trie implementation in C, I felt that I understood tries pretty well, but was having trouble explaining how they work. Since the C code was based on existing code, I ...
24
votes
4answers
38k views

Type-safe Dictionary for various types

Assume the following situation: you have an object that can store any object based on a key (basically, IDictionary<string, object>). You want to store ...
8
votes
5answers
2k views

Bidirectional Dictionary

The management of bidirectional mappings is a reoccuring topic. I took the time to write an (hopefully) efficient implementation. ...
6
votes
2answers
9k views

Pythonic way to flatten nested dictionarys

Here's my attempt to write a function that flattens a nested dictionary structure in Python 3.6 This came about because I had a nested dictionary structure of data I wanted to visualize in the ...
12
votes
3answers
3k views

Codewars: Reduce strings to one character

I am trying to solve a puzzle in a performant way. This is the puzzle. Simply explained: you have a String and you must reduce it to one character with the given rules. This is the solution to the ...
2
votes
1answer
3k views

Optimise compare and match method using scripting.dictionary in VBA

In my previous post I was looking for a better solution to write a single column of a 2D array into a worksheet besides looping between code and worksheet and finally managed to achieve that. On ...
17
votes
1answer
547 views

Python Dictionary Black Magic

I am defining a subclass of a the python dictionary object mpCmd where every item is converted to a lambda. The intended usage is that every item in the dictionary ...
7
votes
0answers
98 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
1answer
223 views

Finding added keys, removed keys, and unchanged keys in ordereddict

I'm comparing two OrderedDict objects and I need to find added keys, removed keys, and keys that are present in both (the intersection). Sets are designed for ...
4
votes
2answers
1k views

A 'flexible' VBA approach to lookups using arrays, scripting dictionary and user input

In my previous post Optimise compare and match method using scripting.dictionary in VBA I wanted to address optimising the scripting.dictionary approach I was using and I feel I have achieved that (...
3
votes
3answers
7k views

Search in a big dictionary Python

I have a big Python dictionary with more then 150,000 keys every key has list value. This dictionary contains infinitive words as key and all grammatical forms of these words as values: ...
2
votes
1answer
2k views

Python lazy dictionary

Here is a lazy dictionary with test cases. ...
2
votes
1answer
121 views

Aggregate loans report without using Python standard aggregate or group functions

I've written the following as a code assignment (Python 2.7). The task is to aggregate the loans csv file from the accounts department by (Network, Product, Month) with the total currency amounts, and ...
1
vote
1answer
3k views

Sorted trie implementation in C

I wanted to store some dictionary data (key/value pairs of strings) in C, and decided to use a trie. I found what looks like a good implementation here, along with some nice notes. In this ...
11
votes
1answer
520 views

iterating over the values of a list of ordered dictionaries

I am facing the following problem: I have a special data structure that is a dictionary whose keys are integers (dimensions). The values are also dictionaries whose keys are strings (geometric types) ...
6
votes
2answers
3k views

Refactor deeply nested if-else

I found a code on my computer that i wrote a while ago. It is based on an exercise from O'Reilly book Programming the Semantic Web. There is a class, that stores RDF triples, that is data in the form ...
6
votes
0answers
365 views

Van Emde Boas tree -based map in Java [duplicate]

(Follow-up question: Improved Van Emde Boas tree based map in Java) For the experimental part of my MSc thesis I was working on van Emde Boas tree, and I have this: ...
6
votes
2answers
291 views

InfixDictionary: Data structure for Infix string lookup

I needed a data structure to quickly find all previously inserted values, that have the given string as key or substring (full text search). At first, I tried out some tree structures (infix trie/...
5
votes
0answers
187 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 ...
4
votes
3answers
295 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 ...
4
votes
4answers
824 views

Recursive conversion from ExpandoObject to Dictionary<string, object>

For my blazor library which is a modification of this awesome library I have to convert an ExpandoObject into a ...
4
votes
2answers
4k views

DataTable runtime grouping on user defined criteria

I one of my tools I use the user can define grouping for a DataTable. The criteria are known only at run-time. To achieve this I use a ...
3
votes
1answer
210 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 ...
2
votes
2answers
886 views

Error Handling When Using Dictionary

I have set up a Dictionary that calls on a class to fill a DataGridView via SQL statements. The problem is in two (out of 5) ...