hashtable

The fundamentals of Hash tables?

I'm quite confused about the basic concepts of a Hash table. If I were to code a hash how would I even begin? What is the difference between a Hash table and just a normal array? Basically if someone answered this question I think all my questions would be answered: If I had 100 randomly generated numbers (as keys), how would I impleme...

Chosing a suitable table size for a Hash.

If I have a key set of 1000, what is a suitable size for my Hash table, and how is that determined? ...

Populate JTable from a Hashtable in Java

I have a function which gets a key from the user and generates a Hashtable (on a pattern specified by the key). After creating a Hashtable, I would like to populate a JTable so that each each column represents a key and every rows represents the values associated with the key. I tried everything but couldn't get this work. I'm not creati...

How can a hashtable be bound to a drop down list?

In vb.net / winforms, how can a hashtable be bound to a drop down list or any other datasource-driven control? ...

c# how hashtable shrinks when elements are removed from hashtable?

Hi, I am looking to find out the logic , if any , which shrinks hashtable in c# when elements are removed from it. Regards Harish ...

How to update C# hashtable in a loop?

I'm trying to update a hashtable in a loop but getting an error: System.InvalidOperationException: Collection was modified; enumeration operation may not execute. private Hashtable htSettings_m = new Hashtable(); htSettings_m.Add("SizeWidth", "728"); htSettings_m.Add("SizeHeight", "450"); string sKey = ""; string sValue = ""; foreach (D...

Hashtable to Dictionary<> syncroot . .

Hashtables have a syncroot property but generic dictionaries dont. If i have code that does this: lock (hashtable.Syncroot) { .... } How i do i replicate this if i am removing the hashtable and changing to generic dictionaries. ...

I'm looking for a way to search the values in a .net hashtable using wildcards

I've got a whole host of values stored in a .net 2.0 hashtable. What I would really like to find is a way to, essentially, do a SQL select statement on the table. Meaning, I'd like to get a list of keys whose associated values match a very simple text pattern (along the lines of "starts with a number".) The final goal will be to remo...

Is there any implementation of IDictionary<K,V> with better performance of the BCL one?

Hi, I'm looking for an implementation of IDictionary with better performance of the standard BCL one. I'm looking for something with constant lookup time that performs really well with large number of elements (>10K) and is more GC friendly. Ps: No, I'm not able to write one by myself :) ...

Faster Insert Oracle Hash Cluster Table

Hi! Since I kicked off the process of inserting 7M rows from one table into two others, I'm wondering now if there's a faster way to do this. The process is expected to finish in an hour, that's 24h of processing. Here's how it goes: The data from this table RAW (word VARCHAR2(4000), doc VARCHAR2(4000), count NUMBER); should find a...

Proper Memory allocation

I have the following construction: typedef struct bucket { char *key; ENTRY *data; struct bucket *next; } bucket; typedef struct { size_t size; bucket **table; } hash_table; But I have no idea how to allocate memory for that. I tried: hash_table* ht = malloc(sizeof(hash_table)*101); in order to create a hashta...

Binary Trees vs. Linked Lists vs. Hash Tables

I'm building a symbol table for a project I'm working on. I was wondering what peoples opinions are on the advantages and disadvantages of the various methods available for storing + creating a symbol table. I've done a fair bit of searching and the most commonly recommended are binary trees or linked lists or hash tables. I was wonderi...

How to iterate over Hashtable in JSP

Hi.. I m doing a stuf in JAVA, as it is working fine.. now i need it to display in a browser using JSP, the following is my code.. Hashtable<String, Hashtable<String, Integer>> hash = categoryCountManager.getFunctionWithSubFunctionCount(1L); setCategoryDetails(categoryCountManager.getFunctionWithSubFunctionCount(1L)); ...

Why doesn't a Dictionary access nonexistent keys like a Hashtable does?

If I'm using a Hashtable, I can write code like this: object item = hashtable[key] ?? default_value; That works whether or not key appears in the Hashtable. I can't do that with a Dictionary<TKey. TValue>. If the key's not present in the dictionary, that will throw a KeyNotFoundException. So I have to write code like this: MyClass...

How do I limit the number of entries in a java hashtable?

Is there a technique such that I can specify a number n such that when the (n + 1)th entry is inserted, the oldest entry is removed first ensuring that the size of the hashtable is always limited to n? ...

How would you represent a hashtable collection in a database schema?

If you were trying to create a domain object in a database schema, and in your code said domain object has a hashtable/list member, like so: public class SpaceQuadrant : PersistentObject { public SpaceQuadrant() { } public virtual Dictionary<SpaceCoordinate, SpaceObject> Space { get; set; } } ...

hashtable in javascript

Dear All I am Using Hashtable in javascript, I want to show the values of following in Hashtable one -[1,10,5] two -[2] three -[3,30,300 ..etc] I have found following code it work for following data one -[1] two -[2] three-[3] How to assign one-[1,2] values to hash table and how to ac...

HashTables in Cocoa

HashTables/HashMaps are one of the most (if not the most) useful of data-structures in existence. As such, one of the first things I investigated when starting to learn programming in Cocoa was how to create, populate, and read data from a hashtable. To my surprise: all the documentation I've been reading on Cocoa/Objective-C programmi...

Fast disk-based hashtables?

I have sets of hashes (first 64 bits of MD5, so they're distributed very randomly) and I want to be able to see if a new hash is in a set, and to add it to a set. Sets aren't too big, the largest will be millions of elements, but there are hundreds of sets, so I cannot hold them all in memory. Some ideas I had so far: I tried just ke...

How to store a hash table in a file?

How can I store a hash table with separate chaining in a file on disk? Generating the data stored in the hash table at runtime is expensive, it would be faster to just load the HT from disk...if only I can figure out how to do it. Edit: The lookups are done with the HT loaded in memory. I need to find a way to store the hashtable (in m...