hashtable

Steps in implementing hashtable in PHP and Mysql

Hi, I am new to programming language and I am using PHP and mysql. I got an assignment to do a hashtables in php. What I need to do is, store items that a user collected and then display it. After do some research over the internet, I will do the following steps when implement the hashtable, please correct me if I am wrong: Set up the ...

Questions about Php and Mysql Hash Table

I am a new php and mysql programmer. I am handling quite large amount of data, and in future it will grow slowly, thus I am using hash table. I have couple of questions: Does mysql have hash table built in function? If yes, how to use that? After couple of days doing research about hash table. I briefly know what hash table is but I ju...

How does a hash table work? Is it faster than "SELECT * from .."

Let's say, I have : Key | Indexes | Key-values ----+---------+------------ 001 | 100001 | Alex 002 | 100002 | Micheal 003 | 100003 | Daniel Lets say, we want to search 001, how to do the fast searching process using hash table? Isn't it the same as we use the "SELECT * from .. " in mysql? I read alot, they say, the "SELECT *" sea...

How to judge number of buckets for TBucketList

I've been using the TBucketList and TObjectBucketList for all my hashing needs, but never experiemented with switching the number of buckets. I vaguely remember what this means from Data Structures class, but could someone elaborated on the nuances of this particular class in Delphi The following table lists the possible values: Valu...

How can I read LINQ group by Query?

Hi there, this is my escenary, I Have a class called Plantilla that contains severals propertyes that allows bind a gridview in wpf, so that was working already, but users tells me that they need re-group the query by some field in database, so I prepare this snippet : var dsTemplates = (from t in db.PLANTILLAs ...

Method to find Key in HashTable

I'm trying to create a method which iterates through a hashtable and returns the key as a string, whats the best way to go about this? EDIT: copied from comment Sorry if I didn't make it more clear, I'm trying to do this in Java. I've created a test class public void runprog() { hashMap.put("Butter", 50); hashMap.put("Beans", ...

What is an example of a Hashtable implementation in C#?

I realize C# and .NET in general already has the Hashtable and Dictionary classes. Can anyone demonstrate in C# an implementation of a Hashtable? Update: To clarify, I'm not ncessarily looking for a complete implementation, just an example of the core features of a hashtable (i.e. add,remove, find by key). ...

Have a good hash function for a C++ hash table?

Hello stackoverflowers :) I am in need of a performance-oriented hash function implementation in C++ for a hash table that I will be coding. I looked around already and only found questions asking what's a good hash function "in general". I've considered CRC32 (but where to find good implementation?) and a few cryptography algorithms. M...

An open adressed hash table using AVL trees with quadratic probing.

Each position in the table contains an AVL tree. Now, insertion and deletion work fine, but the problem comes with the deletion. Suppose I have this: [0]: a0 b0 c0 [1]: d0 e0 f0 [2]: g2 h0 i0 The number indicates that the associated elements have collided, so they have been moved to the other positions by the probing. Now, suppose I'd...

Good way to hash a float vector?

I am well aware of all the problems involved in comparing floats. This is exactly the reason for this question. I'm looking to create a fast hash table for values that are 3D vectors (3 floats - x,y,z). It can be assumed that the length of the vector is always 1.0 (sqrt(x*x+y*y+z*z) is 1.0) Essentially this means that I'm looking for ...

How do I get the number of keys in a hash table in Lua?

myTable = {} myTable["foo"] = 12 myTable["bar"] = "blah" print(#myTable) -- this prints 0 Do I actually have to iterate through the items in the table to get the number of keys? numItems = 0 for k,v in pairs(myTable) do numItems = numItems + 1 end print(numItems) -- this prints 2 ...

Where Do I Store Hash Table or Dictionary Key Names

When I'm working with Hash Tables/Dictionaries I sometimes struggle with how to specify keys. For example: if I create a simple Dictionary (using Python for this example), foo = {'bar': 'baz', 'foobar': 'foobaz' } I can access values (in other modules) with the key values: (foo['bar']) and get baz back. In the words of Dr. Evil, "pr...

How to test if a C# Hashtable contains a specific key/value pair?

I'm storing a bunch of supposedly-unique item IDs as a key and the file locations as the value in a hash table while traversing a table. While I am running through it, I need to make sure that they key/location pair is unique or throw an error message. I have the hashtable set up and am loading the values, but am not sure what to test:...

Best data structure in C for these two situations?

I kinda need to decide on this to see if I can achieve it in a couple of hours before the deadline for my school project is due but I don't understand much about data structures and I need suggestions... There's 2 things I need to do, they will probably use different data structures. I need a data structure to hold profile records. Th...

Is it possible to sort a HashTable?

I have a property that returns a HashTable. I would like to sort it without refactoring my property. Please note: I do not want to return another type. Code: /// <summary> /// All content containers. /// </summary> public Hashtable Containers { get { Hashtable tbl = new Hashtable(); ...

generate random values for unit testing Hast table data type

My project generates few values(equal partitioning method) for each data types by getting the Minimum and Maximum values. i am doing this generating values for functional testing ,i am actually passing this values to nunit partner ,max amd min are applicable to int ,float ,double etc ..these values are test data . Initially i generat...

Assigning a new value to Hashtable without using the Add method

To add a new value to a dotnet Hashtable I've always used: myHashtable.Add(myNewKey, myNewValue); but I've just come across some code which does the following instead: myHashTable[myNewKey] = myNewValue; Is there any difference between the two methods? ...

hash function providing unique uint from an integer coordinate pair

The problem in general: I have a big 2d point space, sparsely populated with dots. Think of it as a big white canvas sprinkled with black dots. I have to iterate over and search through these dots a lot. The Canvas (point space) can be huge, bordering on the limits of int and its size is unknown before setting points in there. That brou...

How to create a property class in c#?

I want to create a class which will have two properties, e.g. key & value. And I want one method which will give me a value based on the key. So what is the code? I know Hashtable but how to implement it in C#? Can I have a string as a key? ...

Associative arrays in Shell scripts

We required a script that simulates Associative arrays or Map like data structure for Shell Scripting, any body? ...