Questions tagged [hashtable]

A hash table in programming is a collection that uses a hash function to map identifying values (keys) to their associated values.

The basic advantage of a hash table is that they provide very efficient lookup and search functionality. Unlike many other linear collection types (such as arrays and linked lists), one does not have to loop through all the elements in a hash table searching for a particular entity.

For Java: https://docs.oracle.com/javase/8/docs/api/java/util/Hashtable.html

4991 questions
1
vote
3 answers

Data Structure for enumeration in c# where lookup is often predicated on one property of the Objects being stored

I'm wondering what Data Structure people would recommend to do the following. I have a Class which has three main properties eg. public class Example { public Object One { get; } public Object Two { get; } public Object Three { get;…
RobV
  • 26,016
  • 10
  • 71
  • 114
1
vote
2 answers

Properties.containsKey returns false, why?

Properties segmentClients = new Properties(); segmentClients.load(new FileInputStream(pathSegmentFile)); segmentClients.containsKey(strANI); //returns false / strANI = "9202599784" file is like this: #…
VextoR
  • 4,804
  • 20
  • 67
  • 106
1
vote
4 answers

Hash table of form - in Java

I just want to know if it is possible to create a hashtable in java of the form . Essentially the first key leads me to a new hash table; then I search that table using another key.
Hari
  • 4,297
  • 7
  • 35
  • 51
1
vote
2 answers

how can i create a dynamic array of a hash table in c

i have the following bucket entry structure and hash table set up typedef struct Hash_Entry { struct Hash_Entry *next; void *key_Data; unsigned key_hash; char key[5]; } Hash_Entry; typedef struct…
John
  • 762
  • 2
  • 16
  • 33
1
vote
2 answers

Java: do-while(regex), hashtable.containsKey() possible?

Can I use a Regular Expression with Hashtable.containsKey(Object value); Is there any way to do the following pseudo-code? while ( myHashtable.containsKey(regex) ) { //TODO }; Where my regex would be "ERROR[0-9][0-9]?" edit: I'm setting any…
emdog4
  • 1,787
  • 3
  • 18
  • 25
1
vote
4 answers

how to get Hash table Arraylist to other intent?

I have hashtbles in array list. List> info = new ArrayList>(); Hashtable hm = new Hashtable(); // Put elements to the map hm.put("Read_Flag",…
Anand
  • 2,743
  • 9
  • 32
  • 51
1
vote
3 answers

table = new HashEntry*[TABLE_SIZE]

I am learning about hash tables and came across the following line of code with weird syntax table = new HashEntry*[TABLE_SIZE]; Can somebody explain to me what this syntax means? I don't understand why there is a '*' before the square…
int80h
  • 255
  • 1
  • 3
  • 11
1
vote
3 answers

copy n k/v pairs from Hashtable

I have a hashtable with n number of records. I need to copy out the records between x and y and iterate through them. How would I do this? Example: HT1.Count = 500; HT2 = HT1[0] - HT1[100]; --edit-- Just so you are aware, the reasoning for this is I…
WedTM
  • 2,468
  • 5
  • 37
  • 52
1
vote
1 answer

Hashtable in SQL Server 2008 R2

I have a requirement where I would like to store the key value pairs or hashtable in my SQL Server table as a column. Can I store a hash table as a column in SQL Server 2008 R2? Please suggest some alternative if not possible. Thanks Prabhanjan
1
vote
4 answers

HashTable with constant size

I'm currently working on a holiday project aimed at simulating biological body clocks. The long & short of it is that I've decided to use a hash table as a "concentration" object to simulate a cell and its interacting units. My main question is: is…
1
vote
1 answer

Getting Hashtable keys in intellisense

I am using hashtable that contains around 60 key,value pairs. for assigning the value based on key to any control in my page i have to explicitly type the keyname. For example: txtName.Text = htData["Name"].ToString(); txtAddress.Text =…
1
vote
4 answers

three item HashMap without internal iteration

What is the best way to implement a three item hashMap? For example, I would like to use a regular String key , but have it map to two different objects. The idea is like having a list of lists, except that the first item is a key. I am trying to…
quinn
1
vote
2 answers

Class as Hashtable key -- is it a good idea?

After some consideration, i implemented caching in my application, basically, using a hashtable that contains Class as a key (which is the class that corresponds to a particular cached entity and inherits from an abstract AbstractCache) and the…
Ibolit
  • 8,071
  • 5
  • 46
  • 76
1
vote
4 answers

How does the search algorithm work with objects in a java collection such as HashSet?

The question really is regarding objects that change dynamically in a collection. Does the "contains" method go and compare each of the object individually every time or does it do something clever? If you have 10000 entries in a collection, I would…
Sid Malani
  • 1,972
  • 1
  • 12
  • 12
1
vote
2 answers

Hashing (double hashing without rehash)

This is the question: Uses open addressing by double hashing, and the main hash function is hi(x) = (hash(x) + f(i)) mod M, where hash(x) = x mod M and f(i) = i ∗ hash2(x) and hash2(x) = 13 − (x mod 7). I need to INSERT the keys 27, 22, 16, 26, 47,…
user1026822
1 2 3
99
100