hashtable

ANSI C hash table implementation with data in one memory block

Hello, I am looking for an open source C implementation of a hash table that keeps all the data in one memory block, so it can be easily send over a network let say. I can only find ones that allocate small pieces of memory for every key-value pair added to it. Thank you very much in advance for all the inputs. EDIT: It doesn't necess...

Create a List<string> from HashTable keys?

Hey, how could I do this as short as possible? Thanks :-) ...

Super high performance C/C++ hash map (table, dictionary)

I need to map primitive keys (int, maybe long) to struct values in a high-performance hash map data structure. My program will have a few hundred of these maps, and each map will generally have at most a few thousand entries. However, the maps will be "refreshing" or "churning" constantly; imagine processing millions of add and delete m...

Efficient bidirectional hash table in Python?

Python dict is a very useful datastructure: d = {'a': 1, 'b': 2} d['a'] # get 1 Sometimes you'd also like to index by values. d[1] # get 'a' Which is the most efficient way to implement this datastructure? Any official recommend way to do it? Thanks! ...

workaround: javascript dictionary which takes objects as keys

Hi, I read a few questions and answers about javascript dictionary implementations, but they don't meet my requirements: the dictionary must be able to take objects as keys the values must be accessible by the []-operator So i came up with the idea to overwrite the "valueOf"-method in Object.prototype, as follows: Object.__id__...

Salting: Is it reasonable to use the user name?

I am debating using user-names as a means to salt passwords, instead of storing a random string along with the names. My justification is that the purpose of the salt is to prevent rainbow tables, so what makes this realistically less secure than another set of data in there? For example, hash( md5([email protected]), p4ss\/\/0rD...

Hash Map with Two keys - Finding all elements linked to one key. C++

Hi, I have an object Line which contains 2 objects of type Point called Point1 and Point2. I want to create a HashMap containing lines and whose keys are std::pair<Point1, Point2>. What I'd like to do is find all the Lines with are referenced (for instance) by Point1, i.e. with key std::pair<Point1, Anything>. I don't care about std::...

HashMap : Dealing with Managed objects C++

Hi, I guess it's kind of a stupid question but here is my problem : I want to have a hash_map<int, Object^> as an attribute of my object BigObject, which is written in managed C++. So I have to declare a pointer, hash_map<int, Object^>* hash because I cannot declare explicitely native object in managed code. How can I insert an objec...

Groovy Properties list from HashTable

I am setting an external file to hold some persistent variables as Properties() Is there an easy way to list these in the same way that System.Properties() does?? to produce a list of Properties I have set. ...

How To - Store Key Value Pair in Two Dimensional Array and HashTable using JQuery?

Can someone please redirect me to the right link or give an example of how to work with two dimensional array or HashTable in JQuery? I tried google but did not get the answer. I want to avoid using any plugins. All i want to do it, store some information and retrieve them like HashTable way. ...

Is it safe to use floats as keys of hashtables?

I need to store pairs of float,int in which the int value stores the number of occurrences of a float value inside a model I'm using for a tool I'm developing and I was wondering if it's safe to do such things.. Finite precision should be an issue when talking floats used to direct comparisons (or as content to be hashed) so I think tha...

Retrieve all keys in a hash table into a string

Hi Guys, The coding language is C#3.0 What is the most optimum method to retrieve all hashtable keys into string separated by a delimiter "," Is the for loop or the foreach loop the only option? Update: the keys are already strings Regards, naveenj ...

ArrayList of Hashtables in C#

I want to have an ArrayList where it contains HashTables. I create a Hashtable and added values. I then added it to the ArrayList. I then changed the values of the Hashtables and added it again the Array List. It does not save the first values and ending having duplicated values which were exactly the same as the last values! Any su...

In-place dictionary inversion in Python

I need to invert a dictionary of lists, I don't know how to explain it in English exactly, so here is some code that does what I want. It just takes too much memory. def invert(oldDict): invertedDict = {} for key,valuelist in oldDict.iteritems(): for value in valuelist: try: entry = invertedDi...

.NET Framework - Any way to get Dictionary<> to be a little faster?

I'm doing a Dictionary<> lookup in an O(n^2) loop and need it to be ridiculously fast. It's not. Does anyone have any insight into how Dictionary<> is implemented? I'm testing Dictionary performance with an isolated test case after running my code through a profiler and determining Dictionary lookups are the bulk of the CPU time.. My...

i need fast and convenient way to organize table data in-memory

Initial conditions: DateTime moment string key double value somewhere across the code i want to Add("2010.08.09 12:55:34", "px_ValX", 10); Add("2010.08.09 12:55:35", "px_ValX", 1); Add("2010.08.09 12:55:35", "px_ValY", 12); Add("2010.08.09 12:55:35", "px_ValZ", 100); Add("2010.08.09 12:55:38", "px_ValZ", 5); and then i want to ...

Operations on Hashtable in C#

Using Hashtable I want to have multiple objects mapped to the same key. E.g. Key is 'Age' and Values are ojects of struct 'Student'. I suppose perceptually there will be a sort of linked list with Key acting as a 'Head' 25->obj1->obj2->obj3 Here are my questions: Is the above representation correct? If not, which data stru...

Java Object and array memory location

I'm writing an array-backed hashtable in Java, where the type of key and value are Object; no other guarantee. The easiest way for me code-wise is to create an object to hold them: public class Pair { public Object key; public Object value; } And then create an array public Pair[] storage = new Pair[8]; But how does the j...

Implementing a hashtable for a question/answer group

What's the easiest way to implement a hashtable (or use a better way) to store a list of questions and their associated answers (1 possible answer per question)? Originally I had created an ArrayList to store the questions. I could have made a second ArrayList for the answers, but once I have a lot of questions, trying to match up quest...

Null pointer when moving data around

Hey Guys, I've got a function filling a HashMap(rMap) of String arrays. Once certain conditions are met e.g r.Map.size() != 0 I then, in another file (rMap is a Global variable) call the following String array[] = rMap.get(0) from this I attempt to System.out.println(array[0]) . Thats the run of the program and I get a null pointer at ...