hashtable

How do I convert a Java Hashtable to an NSDictionary (obj-C)?

At the server end (GAE), I've got a java Hashtable. At the client end (iPhone), I'm trying to create an NSDictionary. myHashTable.toString() gets me something that looks darned-close-to-but-not-quite-the-same-as [myDictionary description]. If they were the same, I could write the string to a file and do: NSDictionary *dict = [NSDicti...

C# Hashtable template match

Which is the best way to determine whether a Hashtable contains all keys/values of another Hashtable ? This can also be interpreted as: how to determine whether a Hashtable is a subset of another Hashtable. ...

Caching aspect - how to create key from method name and arguments

I am creating an aspect to apply to methods that checks the cache for a return value, and only permits procession onto the logic of the method if the cache is empty or stale. I need to generate a cache key for the storage of this information that is unique to the method call for a given set of arguments. My initial hunch is to implement...

probability bound on number of collisions in a hash table

I'd like to get a probability bound on the maximum number of collisions in a hash table. I.e., given number of buckets m, number of items n, what is: Prob(number of collisions < c) as a function of n, m and c, where c is some number between 1 and n. For example, c=1 would be the birthday paradox (~e^(-n^2/2m)) and c=n would be 1. (I...

How to find the size of the hash table?

Hi, I've a hash table defined like this typedef std::unordered_map<unsigned long long int,unsigned long long int> table_map; and in the program, I read the contents of the a file into a buffer using fread like this: fread(buffer, sizeof(long long int), 1024, file1); I declare the hash table as table_map c1; Now i create a hash...

Using scala to call java.util.Hashtable#put

I've an unexpected trouble calling put on an old-school hashtable. What's going on here? Welcome to Scala version 2.8.0.final (Java HotSpot(TM) Client VM, Java 1.6.0_21). Type in expressions to have them evaluated. Type :help for more information. scala> import com.ibm.mq._ import com.ibm.mq._ scala> MQEnvironment.pro...

Data Structure that introduces data like a stack, and stores in buckets like a hashtable?

Hello! I need an algorithm that introduces data like a stack, so when I scan the structure I can read them in the same sequence as they were introduced, for sequential access. Also these values are stored in buckets, like a hashtable, so I can fragment the whole structure for disk storage and have fast random access. Is there an algorit...

Hash tables in Matlab

Does Matlab have any support for hashtables? Some background I am working on a problem in Matlab that requires a scale-space representation of an image. To do this I create a 2-D Gaussian filter with variance sigma*s^k for k in some range., and then I use each one in turn to filter the image. Now, I want some sort of mapping from k ...

UpdateModel with Dictionary/Hashtable

I'm trying out some MVC stuff and I was wondering if there's some way to edit dynamic fields. So to try this I added a keyed collection called CustomFields. I've tried both Hashtable and Dictionary. In the view I then wrote: <%:Html.TextBoxFor(model => model.CustomFields["x"])%> This then generated this HTML: <input id="CustomFields...

Collision-free fixed-size hash table

With 1 good hash function, how can I create a static hash table for N distinct keys that is collision free? I know the keys in advance, so the hash table doesn't have to be resized (hence it is static). Related question: will it always be possible to find a hash table with no collisions? ...

What might be the best method of storing Mandelbrot values in a database?

I'm currently experimenting with rendering a Mandelbrot set and I've quickly come to realize that it would be useful to not have to recalculate the maximum iteration count for each rendering...on the other hand it's a lot of data to keep track of. It seems to me (based on my limited experience with RDMSes) that a relational database is p...

Hashtable with integer key in Java

Hello all, I'm trying to create a Hashtable as in the following: Hashtable<int, ArrayList<byte>> block = new Hashtable<int, ArrayList<byte>>(); but I am getting an error on both int and byte saying "Dimensions expected after this token". If I use something like: Hashtable<String, byte[]> - all is good. Can someone explain why? Tha...

In what languages, associative arrays are implemented using redblack tree instead of hashtable?

In wikipedia: http://en.wikipedia.org/wiki/Red-black_tree#Applications_and_related_data_structures red-black tree is a type of self-balancing binary search tree, a data structure used in computing science, typically used to implement associative arrays. Anyone know a language implemented associative array using redblack tre...

MemberQ in Mathematica

I am a bit at a loss how to do the following efficiently in Mathematica: a = { 1, 2, 3, 4, 5 }; (* list of integers *) b = { 2, 4, 6, 8 }; (* another list of integers *) filter = Table[MemberQ[b, element], {element,a}] Expected output is: {False, True, False, True, False} My lists a and b are big, so Mathematica is doing a kaz...

Adding keys to a list or collection - is there any value in hashing the key before adding it

I have stumbled across some code that is adding strings to a List but hashing the value before adding it. It's using an MD5 hash (MD5CryptoServiceProvider) on the string value, then adding this to the list. Is there any value in doing this in terms of speed to find the key in the list or is this just unnecessary? ...

Powershell error returning hashtable

Anyone have any ideas why the following code would produce an error, see additional comments after the function for more details function callee ([Hashtable]$arg0) { [Hashtable]$hashtable = @{} $hashtable = $arg0 $hashtable.add('passed', $True) # $hashtable ######## toggle this line $typ...

Multiple keys Hash Table (unordered_map)

I need to use multiple keys(int type) to store and retrieve a single value from a hash table. I would use multiple key to index a single item. I need fast insertion and look up for the hash table. By the way, I am not allowed to use the Boost library in the implementation. How could I do that? Thanks. ...

Using hashtable or SQL Lite in my android application

Initially I use hashtable in my android application. The key point I love hashtable is it is able to store complex item such as: coordinate-->float[2], velocity-->float[2]. But from many samples, using SQLlite table in android seems more efficient but it may only store all the values in one row defined by rowID. So can anyone enlighte...

compare pairs stored in hashtable java

at first i have a 2d array storing many numbers and then i used an array of hushtables to store pairs formed by the numbers of each row of the 2d array. for example in the first row of the 2d array, the numbers are 1 2 3 4 5 then the pairs should be 1,2 1,3 1,4 ,1,5 etc. the code for generating the pairs and store in hashtable is H...

What's the big O for JavaScript's array when used as a hash?

What's the big O for JavaScript's array access when used as a hash? For example, var x= []; for(var i=0; i<100000; i++){ x[i.toString()+'a'] = 123; // using string to illustrate x[alpha] } alert(x['9999a']); // linear search? One can hope JS engines will not use a linear search internally O(n), but is this for sure? ...