hashtable

.NET Hashtable clone

Given the following code: Hashtable main = new Hashtable(); Hashtable inner = new Hashtable(); ArrayList innerList = new ArrayList(); innerList.Add(1); inner.Add("list", innerList); main.Add("inner", inner); Hashtable second = (Hashtable)main.Clone(); ((ArrayList)((Hashtable)second["inner"])["list"])[0] = 2; Why does the value with...

Run Time for Linear Probing on Hash table

Hello, what is the running time (big Oh) for linear probing on insertion, deletion and searching. Thanks ...

Does Windows CE support hash tables?

Quick question of does Windows CE support hash tables? I have a program that I'm modifying and adding to a device that uses Windows CE and I was wondering if CE supported hash tables since it is used in the original software. ...

Rationale in selecting Hash Key type

Guys, I have a data structure which has 25 distinct keys (integer) and a value. I have a list of these objects (say 50000) and I intend to use a hash table to store/retrieve them. I am planning to take one of these approaches. Create a integer hash from these 25 integer keys and store it on a hash table. (Yeah! I have some means to han...

Hash Table: Should I increase the element count on collisions?

Hi, Right now my hash tables count the number of every element inserted into the hash table. I use this count, with the total hash table size, to calculate the load factor and when it reaches like 70%, I rehash it. I was thinking that maybe I should only count the inserted elements with fills an empty slot instead of all of them. Cause...

Inserting non-pod struct into a GHashTable

Hi there, I'm trying to build a GHashTable of instances of a struct containing ints, a time_t and a few char*'s. My question is, how do you insert an instance of a struct into a GHashTable? there are plenty of examples of how to insert a string or an int (using g_str_hash and g_int_hash respectively), but I'm guessing thatI want to use...

HashSet versus Dictionary<T, K> w.r.t searching time to find if an item exists

HashSet<T> t = new HashSet<T>(); // add 10 million items Dictionary<T, K> t = new Dictionary<T, K>(); // add 10 million items. Whose .Contains method will return quicker? Just to clarify, my requirement is I have 10 million objects (well, strings really) that I need to check if they exist in the Data Structure. I will NEVER iterate....

Looking for an array (vs linked list) hashtable implementation in C

hi, I'm looking for a hashtable implementation in C that stores its objects in (twodimensional) arrays rather than linked lists. i.e. if a collision happens, the object that is causing the collision will be stored in the next free row index rather than pushed to the head and first element of a linked list. plus, the objects themselves ...

Help using Horner's rule and hash functions in Java?

I am trying to use Horner's rule to convert words to integers. I understand how it works and how if the word is long, it may cause an overflow. My ultimate goal is to use the converted integer in a hash function h(x)=x mod tableSize. My book suggests, because of the overflow, you could "apply the mod operator after computing each pare...

Java hashtable with seperate chaining collision resolution?

I have created a program using the built in java.util.hashtable but now I need to resolve collisions using separate chaining. Is it possible with this implementation of a hashtable? Is there one out there already implemented that uses separate chaining? ...

C# multi-dimensional array, ArrayList, or hash table?

hello, I'm trying to figure out how to build a multi-dimensional "array" that is: flexible size use 2 keys 1st key is int (flexible) 2nd key is string (kind of limited) The use will be like: console.writelen(array[0]["firstname"]); console.writelen(array[0]["lastname"]); console.writelen(array[0]["phone"]); console.writelen(array[...

Does the java JFC hash table use seperate chaining resolution? Can I traverse each list in the table?

I have written a program to store a bunch of strings in a JFC hash table. There are defiantly collisions going on, but I don't really know how it is handling them. My ultimate goal is to print the number of occurrences of each string in the table, and traversing the bucket or list would work nicely. Or maybe counting the collisions? O...

Can hash tables really be O(1)

It seems to be common knowledge that hash tables can achieve O(1) but that has never made sense to me. Can someone please explain it? A. The value is an int smaller than the size of the hash table, so the value is its own hash, so there is no hash table but if there was it would be O(1) and still be inefficient. B. You have to calcu...

How to write a hashtable<string, string > in to text file,java ?

Hi all . I have hastable htmlcontent is html string of urlstring . I want to write hastable into a .text file . Can you suget me a sulution ? ...

C++ hash table implementation with collision handling

What is a good C++ library for hash tables / hash maps similar to what java offers. I have worked with Google Sparsehash, but it has no support for collisions. ...

Can we write hashtable into file ?

I have hashtable, my program want to record the valuse of hashtable to process later! But i have a quesiton . Can web write oject hastable in to file ? if can,how to load that file ? ...

How does Java order items in a HashMap or a HashTable?

I was wondering how Java orders items in the Map (HashMap or Hashtable) when they are added. Are the keys ordered by the hashcode, memory reference or by allocation precedence...? It's because I've noticed same pairs in the Map are not always in the same order ...

how to create a hashtable of json objects in javascript?

I want to create a hashtable of json objects, where each json object represents a user. I want to do this to sort of create a client side 'cache' of users. User { ID: 234, name: 'john', ..); So I can then reference things like this: if(userCache[userid] != null) alert(userCache[userid].ID); is this possible? ...

I need data structure for effective handling with dates

What I need is something like Hashtable which I will fill with prices that were actual at desired days. For example: I will put two prices: January 1st: 100USD, March 5th: 89USD. If I search my hashtable for price: hashtable.get(February 14th) I need it to give me back actual price which was entered at Jan. 1st because this is the ...

C programming question on the implementation of a hash table

Hi, I have a C programming question on the implementation of a hash table. I have implemented the hash table for storing some strings. I am having a problem while dealing with hash collisons. I am following a chaining linked-list approach to overcome the problem but, somehow, my code is behaving differently. I am not able to debug it. Ca...