Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

7
votes
1answer
2k views

Dictionary<TKey, TValue> Implementation

This class encapsulates a List<KeyValuePair> (see List<T> implementation here, and ...
6
votes
0answers
223 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
2answers
6k 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
125 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 ...
5
votes
1answer
63 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 ...
21
votes
3answers
34k 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 ...
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
2k 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
529 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
87 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
218 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 ...
5
votes
2answers
6k 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 ...
4
votes
2answers
847 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
6k 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
112 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
278 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
2answers
275 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/...
6
votes
0answers
364 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: ...
4
votes
2answers
3k 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 ...
4
votes
3answers
289 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 ...
3
votes
1answer
209 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
789 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) ...