hashtable

Print out the keys and Data of a Hashtable in C# .NET 1.1

I need debug some old code that uses a Hashtable to store response from various threads. I need a way to go through the entire Hashtable and print out both keys and the data in the Hastable. How can this be done? ...

Java hashmap vs hashtable

What is the difference between a hashmap and a hashtable in Java, and which is more efficient for non-threaded applications? ...

Literal hashes in c#?

I've been doing c# for a long time, and have never come across an easy way to just new up a hash. I've recently become acquainted with the ruby syntax of hashes and wonder, does anyone know of a simple way to declare a hash as a literal, without doing all the add calls. { "whatever" => {i => 1}; "and then something else" => {j => 2}}; ...

How do you implement GetHashCode for structure with two string

I have a structure in C#: public struct UserInfo { public string str1 { get; set; } public string str2 { get; set; } } The only rule is that UserInfo(str1="AA", str2="BB").Equals(UserInfo(str1="BB", str2="AA")) How to override the GetHashCode function for this structure? ...

Persistent Binary Tree / Hash table in .Net

Hi, I need a pure .Net persistent hashtable/binarytree, functionally similar to berkeley-db Java edition. Functionally it should opperate in a similar maner to a DHT such memcached and velocity etc but it doesn't have to be distributed. In essence I am looking for a persistent hashtable. Does anyone have any ideas or suggestions? A ...

Can anyone recommend a good Hashtable implementation in Javascript?

I've found jCache and some other home-grown methods using associative arrays. If you've had experience with jCache, were there any limitations? ...

Hashtable in C++?

I usually use C++ STL map whenever I need to store some data associated with a specific type of value (a key value - e.g. a string or other object). The STL map implementation is based on trees which provides better performance (O(log n)) than the standard array or STL vector. My questions is, do you know of any C++ "standard" hashtable...

What are hashtables and hashmaps and their typical use cases?

I have recently run across these terms few times but I am quite confused how they work and when they are usualy implemented? ...

Why are entries in addition order in a .Net Dictionary?

I just saw this behaviour and I'm a bit surprised by it... If I add 3 or 4 elements to a Dictionary, and then do a "For Each" to get all the keys, they appear in the same order I added them. The reason this surprises me is that a Dictionary is supposed to be a HashTable internally, so I expected things to come out in ANY order (ordered...

Map an object reference with HashTable

I'd like to map a reference to an object instead of the object value with an HashTable configMapping.Add("HEADERS_PATH", Me.headers_path) that way when I'm going to retrieve the value of "HEADERS_PATH" I'll be able to assign a value to Me.headers_path something like the " & " operator in C ...

How can I convert List<object> to Hashtable in C#?

I have a list of objects, each containing an Id, Code and Description. I need to convert this list into a Hashtable, using Description as the key and Id as the value. This is so the Hashtable can then be serialised to JSON. Is there a way to convert from List<Object> to Hashtable without writing a loop to go through each item in the l...

Hashtable implementation for Delphi 5

Do you know a good and free Hashtable imlementation for Delphi 5 ? I need to organize a huge amount of data in a hastable and I am bit worried about memory leak issues that I found in most available implementations on the web. Tks ...

What is the best way to calculate word frequency in VB.NET?

There are some good examples on how to calculate word frequencies in C#, but none of them are comprehensive and I really need one in VB.NET. My current approach is limited to one word per frequency count. What is the best way to change this so that I can get a completely accurate word frequency listing? wordFreq = New Hashtable() Dim ...

How many hash buckets

If I notice that a hash table (or any other data structure built on a hash table) is filling up, at what point should you build a new table with more buckets. And given n items in the table so far, how do you figure out how many buckets to use in the new one? So let's say I have 100 buckets. Should I reorganize it when there are 50 item...

Cuckoo hashing in C

Does anybody have an implementation of Cuckoo hashing in C? If there was an Open Source, non GPL version it would be perfect! Since Adam mentioned it in his comment, anyone knows why it is not much used? Is it just a matter of implementation or the good theoretical properties do not materialize in practice? ...

How Do I Choose Between a Hash Table and a Trie (Prefix Tree)?

So if I have to choose between a hash table or a prefix tree what are the discriminating factors that would lead me to choose one over the other. From my own naive point of view it seems as though using a trie has some extra overhead since it isn't stored as an array but that in terms of run time (assuming the longest key is the longest ...

Simple hashmap implementation in C++

I'm relatively new to C++. In Java, it's easy for me to instantiate and use a hashmap. I'd like to know how to do it in a simple way in C++, since I saw many different implementations and none of them looked simple to me. ...

C# Collection Data Structure With 1:1 Key/Value Mapping

Are there any built-in C# data structures that are like a hash table but requires both the Keys and the Values to be unique among each other? I basically want a way to look up my Key object in a table via a unique Value and vice-versa. Next to maintaining two hash tables or iterating over each key in the hash table (which is slow), I can...

Hashtable.OnDeserialization

I have a class that maintans a reference to a Hashtable and serializes/deserializes that Hashtable. After the call to SerializationInfo.GetValue, the Hashtable is not fully deserialized because the deserialization happens during the IDeserialization calback. Hashtable hashtable = (Hashtable) info.GetValue("hash", typeof(Hashtable)); I...

Best way to remove an entry from a hash table

What is the best way to remove an entry from a hashtable that uses linear probing? One way to do this would be to use a flag to indicate deleted elements? Are there any ways better than this? ...