hashtable

How to add the value of string into hashtable in iPhone coding?

for(NSString *s in mainarr) { NSString newseparator = @"="; NSArray *subarray = [s componentsSeparatedByString : newseparator]; //Copying the elements of array into key and object string variables NSString *key = [subarray objectAtIndex:0]; NSLog(@"%@",key); NSString *class_name= [subarray objectAtIndex:1]; ...

Speclialized hashtable algorithms for dynamic/static/incremental data

I have a number of data sets that have key-value pattern - i.e. a string key and a pointer to the data. Right now it is stored in hashtables, each table having array of slots corresponding to hash keys, and on collision forming a linked list under each slot that has collision (direct chaining). All implemented in C (and should stay in C)...

How to write a hash function in C?

Hash Tables are said to be the fastest/best way of Storing/Retrieving data. My understanding of a hash table, hashing is as follows (Please correct me if I am wrong or Please add If there is anything more): A Hash Table is nothing but an array (single or multi-dimensional) to store values. Hashing is the process to find the index/loca...

Symbol Table Overflow Issue in Ruby

I have written some Ruby code to import the Google n-gram data into a hash table, mapping word unigrams to their respective counts. I'm using symbols as opposed to strings for the keys. I've been running this code on a linux box for a while now with no problems. Running it on my Mac this morning yielded a symbol table overflow runtime...

Linear Hashing Implementations

Does anyone know if there is a C# implementation of Linear Hashing? Failing that are there any implementations in any other language where the code is available? ...

Pass a c# object of type HashTable as argument

Is it possible (in C#) to pass an object of type HashTable as a parameter to a method? I'm trying to, but it seems (at debug-time) impossible to reference the object (i'm getting a null reference object). ...

Why use an array to implement a "list" instead of a hash table?

Consider an array versus a hashtable where the keys are just the integral indexes of a list. Their average-case insertion, lookup, and removal big-O bounds are all O(1) constant time. I understand that you may get some low-level wins in cache locality with an array, and there is a marginal (mostly-constant) overhead to the hashtable ope...

For general cases, when either one would work, which is better to use, a hashmap or a hashtable?

I've used hash tables occasionally in a couple of languages, but I just came across the Java map while browsing through some code. I checked up the differences in this SO question, which expressed it very clearly. My question is this: When either one could work for you , which is better to use? Which one should you choose if you're no...

Glib hash table replace

I'm using GLib Hash Table. I'm trying to get the current value of the key that I found and then increment its value. I'm not quite sure how can I replace the existing value. typedef struct { gchar *key; guint my_int; } my_struct; char *v; v = g_hash_table_lookup(table, my_struct.key); if (v == NULL) g_hash_table_insert(tab...

How to get all the contents of Hashtable and put into NSMutableArray?

hello, How to get all the contents of Hashtable[NSMutableDictionary] into NSMutableArray , which is to be done for iPhone application? ...

Using a GridView (XtraGridView) to display contents of a Hashtable

I have many kinds of objects - the design is such that is not practical to create a subclass for every conceivable combination of attributes. Instead, I have a Hashtable called Attributes that holds the data for each one. I'm trying to display the contents of Attributes in an XtraGridView/GridView. I'd like each of the key/value pairs t...

How do I add data from cache to a DataTable?

Hi everyone: I am embarrassed to ask, but what is the best way to add key/value pair data in cache (HttpRuntime.Cache) to a DataTable? I'm currently dumping the key/value pair data from cache into a HashTable, which becomes the DataSource for a Repeater object. Unfortunately, I cannot sort the data in the Hashtable and therefore though...

how to find and return objects in java hashset

According to the HashSet javadoc, HashSet.contains only returns a boolean. How can I "find" an object in a hashSet and modify it (it's not a primitive data type)? I see that HashTable has a get() method, but I would prefer to use the set. ...

A couple of questions about Hash Tables

I've been reading a lot about Hash Tables and how to implement on in C and I think I have almost all the concepts in my head so I can start to code my own, I just have a couple of questions that I have yet to properly understand. As a reference, I've been reading this: http://eternallyconfuzzled.com/jsw_home.aspx 1) As I've read on the...

how to get the hashtable object form a class to activity in android

hi I want to get the hashtable object from non activity class to activity class an android please reply to me thanks ...

Why can I write and read memory when I haven't allocated space?

Hi, I'm trying to build my own Hash Table in C from scratch as an exercise and I'm doing one little step at a time. But I'm having a little issue... I'm declaring the Hash Table structure as pointer so I can initialize it with the size I want and increase it's size whenever the load factor is high. The problem is that I'm creating a t...

What's the difference between intializating a struct as pointer or not?

Hi, I have the following for my HashTable structure: typedef char *HashKey; typedef int HashValue; typedef struct sHashElement { HashKey key; HashValue value; } HashElement; typedef struct sHashTable { HashElement *items; float loadFactor; } HashTable; I never really thought about it until now but I just realized th...

Moving from Linear Probing to Quadratic Probing (hash collisons)

Hi, My current implementation of an Hash Table is using Linear Probing and now I want to move to Quadratic Probing (and later to chaining and maybe double hashing too). I've read a few articles, tutorials, wikipedia, etc... But I still don't know exactly what I should do. Linear Probing, basically, has a step of 1 and that's easy to do...

Iterating hashtable in java

I have a hashtable in java and want to iterate over all the value in the table and delete a particular key,value pair while iterating. Is there some way i could do that ...

System.Collections hashtable - searh for most recentle added match

I have a hashtable with id-name value pairs. the id is entered as the key, and the name as the value. I am then searching the table, and returning the key whose value matches a specified string like this: (folderValue is the specified string) String^ key; for each (String^ aKey in table.Keys) { if ((String^)table.default[aKey] == fo...