Today I was discussing with another developer about a limitation in a third party library, where we couldn't use spaces in a string. The reasoning was that the strings were used as keys in a .NET Hashtable, and that searching a .NET HashTable was significantly slower when the keys contained spaces.
Now since I'm too lazy to write a test...
How to store object or hashtable in cookies?
I am trying to store multiple values in hastable/class to the cookie in my asp.net mvc (C#) application.
How to do it?
...
Let's say I want to build a perfect hash table for looking up an array where the predefined keys are 12 Months, thus I would want
hash("January")==0
hash("December")==11
I run my Month names through gperf and got a nice hash function, but it appears to give out 16 buckets(or rather the range is 16)!
#define MIN_HASH_VALUE 3
#define M...
I know something like this has been asked before, but the answer was sort of side tracked.
I want to develop a hash function which will take a word and spit out an address of an array.
So, for example, if you input god:
sort the word, d o g
perform some sort of function on this to get an address d o g -> some number
insert 'dog' into...
Hello,
In .NET you can select a hashtable as type for a usersetting. However when I save it and retrieve it in this way, it doesnt seem to have saved it at all.
Hashtable t = new Hashtable();
t.Add(1,"Foo");
t.Add(2,"Bar");
Properties.Settings.Default.Setting = t;
Properties.Settings.Default.Save();
if(Properties.Settings.Default.Sett...
Hi,
For a long time I had the following bookmark in Firefox:
http://www.codeguru.com/csharp/.net/net_general/keyboard/article.php/c4639
I know decided to read it and implement it in the application it was supposed to be implemented some time ago. However, I don't see any benefit in such a method...
I know that the idea behind the hast...
I know the value of key for my Hashtable,
from key how can I obtain the object of DictinaryEntry.
I don't want to Iterate over Hashtable.
...
The hash structures I am aware of - HashTable, HashSet & HashMap.
Do they all use the bucket structure - ie when two hashcodes are similar exactly the same one element does not overwrite the other, instead they are placed in the same bucket associated with that hashcode?
...
How can I update the values of one hashtable by another hashtable,
if second hashtable contains new keys then they must be added to 1st else should update the value of 1st hashtable.
...
Ok, so I've been doing some experiments with hash tables and different collision resolution problems. I'm trying to figure out which is more efficient for doing finds, a hash table that uses separate chaining or quadratic probing for collision resolution. My results suggest that separate chaining is faster than quadratic probing even for...
Using .NET 3.5, is there a way to retrieve a value from Hashtable corresponding to the key without iteration?
...
Hi
In several hash table implementations I've seen the usage of heuristics like "transpose" or "move to front" for items in a bucket.
What are the advantages of using such heuristics? I could't figure it out myself.
Which other optimizations can be done at the hash table / bucket level, why, and under which circumstances?
Optimizing...
Hi. I am trying to understand some things about jump tables and its relationship between a switch case statement.
I was told that a jump table is a O(1) structure that the compiler generates which makes lookup of values essentially about as fast as you can get. However in some cases a Hashtable/Dictionary might be faster. I was also tol...
I've got a hashtable that I want to update from a second hashtable. For any of the keys that match I want to copy the value over. The problem I have is when I enumerate the hashtable keys and try to cast each to a string I receive an exception about casting a Guid to a String. Well it's the string I want. When you use the index operator ...
I need to read file and split string into hash table in C#.
For example;
1231231 Hi this is the first entry / hi this is the second entry
Currently, I'm reading the lines in the files line by line using a StreamReader, and then I splitting every line to 3 different strings. For example, "1231231" to one string, then up to "/" sign to...
First of all I assume I've missed something major when thinking about this, but I still wanted to post about it to see if I really didn't miss anything, on with it...
I have a pretty write heavy binary tree (about 50/50 between writes and reads), and on the way home today I was thinking about ways to optimize this, especially make the w...
We've just encountered this error on our web app, and immediately found the article here http://stackoverflow.com/questions/505322/hashtable-insert-failed-load-factor-too-high-asp-net-2-0.
However, the hotfix that this points to (http://support.microsoft.com/?id=927579) was already included in .NET 2.0 SP1 (http://support.microsoft.com/...
I want my hash to sort in descending order according to the values. How do I do that in Java?
...
Consider the following code:
byte[] bytes = new byte[] { 1, 2, 5, 0, 6 };
byte[] another = new byte[] { 1, 2, 5, 0, 6 };
Hashtable ht = new Hashtable();
ht.Add(bytes, "hi");
Assert.IsTrue(ht.ContainsKey(another));
Why does this assertion fail? Being an array of a primitive type shouldn't use using the object reference, should it? S...
I need a class that will work like C++ std::map. More specifically, I need such a behavior:
map< string, vector<int> > my_map;
Is it possible?
...