hashtable

What is a hashtable/dictionary implementation for Python that doesn't store the keys?

I'm storing millions, possibly billions of 4 byte values in a hashtable and I don't want to store any of the keys. I expect that only the hashes of the keys and the values will have to be stored. This has to be fast and all kept in RAM. The entries would still be looked up with the key, unlike set()'s. What is an implementation of this ...

javascript accessing name value pairs

I'm getting JSON name/value pairs that looks like this: { "Name":"parentid", "Value":"blah" }, { "Name":"siteid", "Value":"blah" }, { "Name":"sitename", "Value":"blah" } But I would like to access the "name" value as the KEY, and ...

Updating posting file with new data in C#

Hello, I need to implement a search engine. So I have a dictionary which is a hash table and it consists words. Also I have some texts, I need to go over all the texts and put into the posting file the text number and the place of each word in the texts. So each time I have an occurrence of some word and that word already exists in the...

how does the hashCode() method of java works ?

Hello I am curious how java generates hash values by using hashCode() method of the Object API ? ...

Java Hashtable problem

Hi All, I am having some problem with java hashtable. Following is my hastable key and values {corpus\2.txt=[cat sparrow], corpus\4.txt=[elephant sparrow], corpus\1.txt=[elephant cow], corpus\3.txt=[cow cat]} So if i want to access first tuple i have to pass key "corpus\2.txt" to get its value. If i pass value i can get it's key. But ...

Use a Java hash map even when there is no "mapping"?

I want to store some objects and then be able to retrieve them later as efficiently as possible. I will also remove some of them under certain conditions. It seems a hash map would be the right choice. But, from what I've seen, hash maps always associate a value with another? For example, "john" and "555-5555", his phone number. Now, m...

Map list onto dictionary

Is there a way to map a list onto a dictionary? What I want to do is give it a function that will return the name of a key, and the value will be the original value. For example; somefunction(lambda a: a[0], ["hello", "world"]) => {"h":"hello", "w":"world"} (This isn't a specific example that I want to do, I want a generic function li...

Quadratic testing in hash tables

Hello, During an assignment, I was asked to show that a hash table of size m (m>3, m is prime) that is less than half full, and that uses quadratic checking (hash(k, i) = (h(k) + i^2) mod m) we will always find a free spot. I've checked and arrived to the conclusion that the spots that will be found (when h(k)=0) are 0 mod m, 1 mod m, ...

How do I use Hashtables/HashSets in .NET?

I have a list of ~9000 products, and some of which may have duplicates. I wanted to make a HashTable of these products with the products serial number as their key so I can find duplicates easily. How would one go about using a HashTable in C#/.NET? Would a HashSet be more appropriate? Eventually I would like a list like: Key-Seri...

Implementing a direct address table

I was given as homework the "Introduction to Algorithms" exercise 11.1-3 which goes as follows: Suggest how to implement a direct-access table in which the keys of stored elements do not need to be distinct and the elements can have satellite data. All three dictionary operations (Insert, Delete and Search) should run in O(1) time. D...

A hashing function which recursively builds?

Is there a (Well known) hash function for string s which can be computed from hashes of subsets of s. e.g. hash(0 to x) is hash(0 to x/2) + hash(x/2 to x) // plus or any other mathematical operation ...

.NET hashtable: How to simulate "Load factor too high" exception

Hi folks: Our production repeatedly met "Hashtable insert failed. Load factor too high". 1. How could I simulate this kind of exception? 2. If this sort of exception is thrown, would the existing key/value will disappear? Thanks for any help. ...

Sorted hash table (map, dictionary) data structure design

Here's a description of the data structure: It operates like a regular map with get, put, and remove methods, but has a sort method that can be called to sorts the map. However, the map remembers its sorted structure, so subsequent calls to sort can be much quicker (if the structure doesn't change too much between calls to sort). For e...

Hashtable<String, Object> not finding strings

I have a Hashtable of type Hashtable I've loaded several strings as keys, one of which is "ABCD" However, later when I go to look up "ABCD", the Hashtable returns null instead of the associated object. Further the keyset contains "ABCD", but a request to containsKey("ABCD") returns false. Is this because String objects are inherently ...

hash of java hashtable

The hashCode of a java Hashtable element is always unique? If not, how can I guarantee that one search will give me the right element? ...

how to create , store and retrive the values from hash table in c#?

how to create , store and retrive the values from hash table in c#? ...

Hashtable - out of memory

Hi. I am using Hashtable in my c# application. I am loading millions of key into, but after the application exceed the 3,7GB of RAM it gives me an "out of memory" exception. I use x64 operation system, and the computer has 16GB of ram. I was thinking about maybe this could be an x86 limitation. I changed the build type to x64 but I stil...

What is the true difference between a dictionary and a hash table?

I've always used dictionaries. I write in Python. ...

How to HTMLEncode arbitrary datasets returned from ScriptService

I've exposed an ASP.NET ScriptService that returns the results of a user defined query. In this case, I'm returning the resulting dataset as a JSON serialized IEnumerable<IDictionary>. Each IDictionary represents a dataset row and contains an arbitrary number of key/value pairs. Although most returned values are primitive types, occasi...

Why are linked lists almost always used with separate chaining?

It seems as though every time I see a mention of separate chaining in a hash table, a linked list is used as the data structure to store items with collisions. Why is this? For instance, why couldn't you use a vector/array data structure? ...