Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
5 votes
2 answers
965 views

Optimized data structure mapping finite set of integers to values in C++

I'm looking for a mapping data structure, but knowing that the possible values of my keys are small numbers, I would like to trade memory for better performances (for both random access and value ...
Delgan's user avatar
  • 611
4 votes
2 answers
157 views

Sort a dict by keys, assuming keys are orderable

I found a suspicious code snipped in an existing project in which I am involved as a developer. The code sorts a dict by its keys, so that if iterated over the dict,...
Looser User's user avatar
5 votes
2 answers
2k views

Hash table implemented in C with open addressing

While posting this, I noticed there are quite a few similar C hash table implementations here already. So I figured one more wouldn't hurt. :-) In any case, I'm writing a teaching article on "how ...
Ben Hoyt's user avatar
  • 629
4 votes
1 answer
107 views

Data set with many variables in Python, many indented dictionaries?

I am working with a data set that has many variables. Currently I am storing the data in many indented dictionaries in the following way: ...
user171780's user avatar
2 votes
1 answer
963 views

Generic hashmap with dynamic resizing and collision handling

This is a (more or less) continuation of a previous post I made: Generic implementation of a hashtable with double-linked list. I got lots of valuable feedback, so I decided to rewrite the entire ...
766F6964's user avatar
  • 901
2 votes
1 answer
144 views

Print the App Name Using Latest Version

I am trying to solve a problem, where we are given an app name, service name, and version number of an api. We need to print the name of app, which is using the latest version for most of the service. ...
vikash srivastava's user avatar
1 vote
1 answer
149 views

Dictionary or custom Collection

I have a list of rule names coming from .xml file. These rule names needs to be validated against rule names in database (Validator.cs). If valid, then ...
iniki's user avatar
  • 335
3 votes
1 answer
137 views

Generic Macro Generated Hashset in C

The Hashset uses open addressing, linear probing and Robin Hood hashing for handling collisions. It comes with insert and remove ...
LeoVen's user avatar
  • 325
0 votes
1 answer
107 views

java.util.Set extension/implementation

Lately, I was working on some experimental java.util.Set extension, IdSet: ...
Wojciech Karwacki's user avatar
5 votes
1 answer
2k views

Complete ObservableDictionary

In conjunction with a recent question of mine, I found that an ObservableDictionary would be very handy for my situation, so I decided to implement one. I've ...
Denis's user avatar
  • 8,508
1 vote
2 answers
114 views

Given a list containing dates and the amount spent on each date, display the total amount spent per month

I had an interview yesterday where I was asked to write a function that would take in a list containing a date and the amount of money spent on that date, and to output the total amount spent per ...
Eoin's user avatar
  • 263
3 votes
1 answer
14k views

Generate JSON for Map<String, Map<String, List<String>>>

Consider I have a String: ...
Seemant Shukla's user avatar
12 votes
1 answer
2k views

Enumerable Custom Collections in VBA with Dictionary features like Exists

To Collect or Hash The VBA.Collection has a number of limitations, but it is enumerable and you can refer to items by index or key. But the VBA implementation of a ...
ThunderFrame's user avatar
  • 1,959
0 votes
3 answers
204 views

Map class made easy for beginners to understand

I want to explain to beginners what a Map is in Java, with the assumption that beginners do not understand what a hashcode is. As I developed games (Tarot, Belote, ...
cardman's user avatar
  • 13
5 votes
1 answer
5k views

GetHashCode of a Dictionary

There is a huge documentation about using and generating hashcodes for objects that will go into a dictionary, really few more if you try to look about hashcode of a dictionary. No, the default ...
TheQult's user avatar
  • 268
3 votes
1 answer
158 views

class Taboo<T> -- sort passed in List<T> according to 'rules'

I know as a matter of fact that there are many areas upon which my code could be improved. I was wondering if anyone can provide me with suggestions on how Taboo ...
Thor's user avatar
  • 607
4 votes
3 answers
5k views

Custom Implementation of ObservableDictionary

I recently found myself in need of an IDictionary<TKey,TValue> implementation that was observable from a WPF UI. Since the .Net framework does not provide ...
psubsee2003's user avatar
10 votes
1 answer
456 views

ConcurrentDecayingHashMap<K,V>, a concurrent decaying HashMap

I wrote a wrapper for Java's ConcurrentHashMap that enables you to add a decay time to inserted values, meaning they will be automatically removed after the given ...
ASA's user avatar
  • 463
2 votes
1 answer
3k views

Generic util method to convert in single map from list of array of Object generally result of JPQL/ hibernate

I have designed a generic method to convert list of array of Objects to result into single map. This is working fine, but I want to check weather a key object is valid key (whether it is overriding ...
khushnood's user avatar
  • 123
8 votes
4 answers
9k views

Iterate over two collections of equal length

What's the best way to iterate over two collections of equal length? Currently I'm using this: ...
Nick Udell's user avatar
  • 5,197
5 votes
2 answers
4k views

Bidirectional map based on memory manipulation

This is a bidirectional map implementation that stores the values as pairs on the heap, and uses pointer arithmetic for efficient lookup. codepad link, may be easier to read ...
Vittorio Romeo's user avatar
9 votes
2 answers
8k views

Thread-safe LRU Dictionary in C#

Can't seem to find one, so trying to build a very simple but fast implementation. Thought I would post on SO for review/feedback, and so that others can just copy/paste for their own use. I'm using a ...
Jamona Mican's user avatar
3 votes
2 answers
2k views

Iterating thousands of times over large collections: advices

This is a pet project :) I have hundreds of playlist files .m3u whose many entries have a wrong path. I'd like to fix them programmatically. Suppose one of my .m3U contains the following entry: <...
roland's user avatar
  • 141
6 votes
1 answer
209 views

Overlapping table fragments

One of my side projects is a table driven scanner/parser generator, in an effort to reduce the size of the transition table I represent the generated table A[x, y] ...
Brian Reichle's user avatar