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.
5,475
questions
0
votes
0
answers
43
views
how to init a hashtable and how to test it in c [closed]
so i start to implement the struct hashtable init :
struct hashtable *hashtable_init(size_t size, size_t (*hash)(char *key))
{
if (hash == NULL || size == 0)
{
return NULL;
}
...
0
votes
0
answers
13
views
Java to Dart - Hash Table Open Addressing Implementation
/**
* Base class for hashtables with an open addressing collision resolution method such as linear
* probing, quadratic probing and double hashing.
*
* @author William Fiset, william.alexandre....
0
votes
1
answer
40
views
Working with Powershell Arrays,HashTables, and JSON
I'm currently working on a project developing PowerShell commands to administer a device my company makes. The device responds to all sorts of different APIs for all its functions.
I'm currently ...
0
votes
1
answer
27
views
How can I build a hashtable from a .csv where the first field in the csv row is the key and value is an array of the rest of the fields in that row
I need to create a hash table from a list of email addresses in a csv file, where the first field of the row is a key and the rest of the fields in that row are a list of email addresses.
ex...
...
1
vote
2
answers
35
views
Is there any advantage to an incremental rehash?
I'm taking a college course on data structures. After the section of lectures on hash tables, our teacher has assigned a project, which is pretty much just making a hash table with some extra bits. ...
0
votes
1
answer
75
views
cannot convert from string to float after read from .csv file and store in hash table
I read data from csv file as a string using "getline( )" method and then I store it in hash table but some data are in float. I want to convert from string to float and store in hash table.
...
-1
votes
0
answers
18
views
Flowchart of a HASH FUNCTION
I have to create a flowchart for code that uses a hash table as a data structure. The code works with a collection of data similar to a database, which has predefined columns, but the user can add or ...
0
votes
1
answer
20
views
Powershell hashtables [duplicate]
I would like to use in my scripts hashtable from external file. I red about *psm1, *psd1 but unfortunately don't know how to use it.
Let say, I have hashtables as shown on below example:
$hash1 = @{ &...
0
votes
0
answers
22
views
PowerShell PictureBox Object in a New Runspace - Not Showing
I have a button click event handler that runs commands. I wanted to add a spinning wheel GIF for the user experience.
I added a picturebox object with the GIF as the image.
If I change the visibility ...
0
votes
1
answer
47
views
powershell find which hash table key is contained in a string
I want to query the operating system name, and will receive results like this:
Microsoft Windows Server 2022 Standard or Microsoft Windows 11 Enterprise.
I would like to correlate this with arbitrary ...
1
vote
2
answers
162
views
Iterator invalidation with unordered_set/unordered_multiset
I know that unordered_set might invalidate iterators when elements are inserted:
"If rehashing occurs (due to the insertion), all iterators are invalidated."
It is clear, because we have ...
1
vote
2
answers
43
views
Powershell - Search an array for presence of value from a hash table
I am loading the header row from an Excel spreadsheet to an array and need to compare it to a hash table that has multiple key entries per value. I need to be able to have different variations for ...
0
votes
0
answers
31
views
Enormous difference in the number of Hash Table collisions with linear probing based on input data
I am running performance tests on a Hash Table while trying two different data sets and array sizes.
The first data set contains 100 000 random Integers converted to strings fe. "-52917" &...
2
votes
1
answer
79
views
Hashtable Subclass With Overloaded Operators
Taking the example Hashtable subclass created in c#:
public class CustomHashtable : Hashtable
{
public CustomHashtable() : base() { }
public CustomHashtable(Hashtable a) : base(a) {}
...
0
votes
0
answers
46
views
Hash functions which avoid collisions on a fixed set of inputs
I have a space of size ~238 from which I sample a set of ~228 distinct objects (their distribution is structured but hard to characterize). I need a procedure for taking one such sample and ...
0
votes
0
answers
32
views
Performance of very large dictionaries when storing/loading via pickle
I have a very large dictionary (multiple millions) which will also be accesses multiple millions times.
I was wondering about the low-level performances of such dicts because if they need to be ...
2
votes
1
answer
32
views
Hashtables: Use previous property to generate next property
Is there a way to generate a Hashtable that uses properties just defined in the hashtable to create the next property down the line? I know I can just do it line by line instead, but I would like to ...
0
votes
1
answer
82
views
Why does accessing the cells of my hashtable return question marks?
I would like to fill in a hashtable with characters read from a user inputted file as character arrays (i.e. character arrays whose first element is a character and whose second element is the NULL ...
3
votes
1
answer
47
views
Distributed Hash Tables: Preventing nodes from storing petabytes of data?
I am reading up on distributed hash tables and Kademlia. But I have one pretty big question that I haven't seen answered.
Nodes can broadcast their files by hashing the filename and sending it off to ...
0
votes
1
answer
60
views
All values in array pointer being modified upon function call
So, I have this hashtable data structure based on a linked list data structure:
//linked list node
struct node{
char* symbol;
int weight;
struct node* succ;
};
typedef struct node node;
...
1
vote
2
answers
49
views
Read data in file from powershell
I have a file with data that looks in this pattern.
[hashtable[]]$Counties =
@(
@{"County1" = @{"City"="New York"
"State"="NY"
...
1
vote
1
answer
49
views
How to get list string from Hashtable?
I don't how to get list values
Hashtable hshTable = new Hashtable();
List<string> l= new List<string>();
l.Add("string1");
l.Add("string2");
hshTable.Add("1",...
1
vote
2
answers
42
views
median with hash table in sas 9.4
I want to calculate a median by groups for 100 variables with hash tables.
I have find this to calculate the median of invoice on sashelp.cars, but if I want to do the median by Make and Model, for ...
-1
votes
1
answer
71
views
Java hashtable occurence number
Hello, please I have a problem understanding the Hash table.
I just read that it is a table with key and value.
Here I will calculate the occurrence number of each word in the file.
It works but I ...
0
votes
2
answers
43
views
How to handle negative values in a chess transposition table hash function?
I am writing a chess engine in Java. In order to optimize search speed, I implemented a transposition table to store the results of previous searches. In transposition tables the position is typically ...
1
vote
0
answers
37
views
Generate the code to create a HashTable/PSCustomObject from an existing object [duplicate]
I am looking for a way to generate the code to create a HashTable/PSCustomObject from a variable that already exists.
Function Call
$response = Invoke-RestMethod <Parameters>...
Contents of $...
3
votes
2
answers
84
views
How would you implement a thread-safe function which reads from a shared hashtable using a key and updates the value in a multi-threaded environment?
Suppose we have some function which takes in a key, retreives its value from a shared hashtable, and perform some operations on it to obtain a new value , and then updates the hashtable with this new ...
1
vote
2
answers
55
views
Powershell array to hashtable cannot get key's value with bracket notation but dotting works?
I am trying to mutate an array into key-value pairs as a hashtable, this procedure seems to create a list of hashtables but they act almost as intended. How can I go about and create a single ...
-2
votes
1
answer
60
views
Hash table related syntax errors in an AWK script? [closed]
I'm running into these two syntax errors when attempting to run the AWK script included below:
awk: syntax error at source line 30 source file test.awk
context is
dealer_schedule[last_name] = &...
-1
votes
1
answer
45
views
How to have a key (string) not freed for global and mutable HashTable in a DLL with Rust?
I'm trying to implement a cross-platform DLL/SharedObject written in Rust. I have a global and mutable HashTable initialized in this library. When i add a key and value in this HashTable, the key (a &...
3
votes
2
answers
79
views
How can I remove $null and whitespace key/value pairs in a [System.Collections.Specialized.OrderedDictionary] using PowerShell 7?
There are plenty of examples of removing null and empty/whitespace keys from arrays, hashtables, and PSCustomObjects. I've adapted and merged several functions I found on this site to come up with ...
1
vote
1
answer
17
views
Problem with implementing the word error checking code
I'm trying to implement a code that will load words from the dictionary into the hash table structure and then compare the words with the sample text and print out how many errors there are. ...
0
votes
1
answer
23
views
Powershell group array collection by path as one element, then remaining items into array as second element
Long story short, I'm pumping NTFS permissions into accesscontroldsc/ntfsentry (was using cntfs, but it doesn't work with winsrv2019 and has different keys) dynamically from a source server using get-...
0
votes
1
answer
72
views
Powershell converts hashtable to system objects when returning from a function
I have a function that creates a hashtable and returns it. My problem is that when returned, its converted to a system object with 2 entried, and my hashtable at entry 3.
sample code:
Function Get-...
0
votes
0
answers
23
views
case sensitive New-Object psobject -Property Hashtable - Azure Tags reporting
I’m new to PowerShell and still finding my feet. So any help will be greatly appreciated. Thanks in advance.
This is for Azure Tags and I used the solution by Lukasz G. Export Azure Resource Groups ...
3
votes
2
answers
68
views
HashTable enumeration with unexpected results
This may be a dumb question so please be kind LOL. I'm trying to wrap my head around something I just ran into.
First
I have a HashTable that I can enumerate using the following:
$ht = [hashtable]@{&...
2
votes
1
answer
80
views
Passing Hashtable Parameter from CommandLine PowerShell 7.2
I am trying to create a PowerShell script, and one of the parameters of the script is a Hashtable. I am using PowerShell 7.2 for this project, and whenever I try to pass a Hashtable in through the ...
3
votes
1
answer
61
views
Why I can use both `Name` and `Key` to get the key in `$hashTable.GetEnumerator()`?
I'm a novice in PowerShell. Recently, I've been using a hashtable in PowerShell and getting the keys and values of it.
For example, there is a hashtable as:
$hashTable=@{
a = 1
b = 2
c = 3
}
And if ...
-1
votes
1
answer
36
views
Hash Table - Unsuccessful search
Anyone has any explanation about the part tow of the question the Unsuccessful search
I want to understand the Unsuccessful search in the hash table
why we have that answer and based on what .
0
votes
3
answers
64
views
Why does hash table printing function not work?
I don't understand why when I create the person structs and insert before, it outputs correctly, but the person structs created from the text file do not.
In my program, I would like to display the ...
0
votes
1
answer
48
views
PowerShell update hashtable values in foreach loop
I'm trying to update each value in my hashtable with a string replacement.
I tried solutions mentioned here, but to no avail.
My current code generates the values with the required replacement. But ...
0
votes
1
answer
51
views
CS50 Speller segfault
i can't seem to understand where the segmentation fault is coming from. my understanding of a hashtable is that you calculate a hash value for the input ( a string in this case ) and use the said ...
0
votes
1
answer
27
views
PowerShell: How to transform hastable array values like this?
Given this PowerShell:
$groupsToProcess = [ordered]@{
groupName = @('group1', 'group2')
ou = @('ou1', 'ou2')
}
$groupsToProcess.GetEnumerator() | ForEach-Object {
$_.Value
}
The output ...
0
votes
2
answers
75
views
cs50 speller - C language [closed]
I am a little lost in this problem (this is the first CS course I have taken) and I would like for someone to look this code and tell me if it look ok or if I am on the right track.
The idea is to ...
0
votes
1
answer
113
views
Hash Table using quadratic probing question
I've attached a screenshot of the question I'm not sure about. Why would the string "Banana" % 13 go to spots 8 and 9?
I didn't really try anything other than mod 13 in each spot and since ...
0
votes
0
answers
28
views
Select statement return a collection rather than individual item - Powershell
I'm trying to grab and old Archive date to compare it to today to see when was the last time data was written to a certain table and present a report. However, I'm not able to break the ...
2
votes
1
answer
57
views
Empty API response after moving from Python to Powerhsell
I developed a bot to scrape some info via "API" in Python and now I want to change the stack to Powershell.
I'm having difficulties with one of the requests. In Python it works like a charm ...
1
vote
2
answers
176
views
Ruby RBS: Declaring schema for a hash
In the application my team and I are working on, we heavily utilize Ruby hashes as data transfer objects(DTOs). Also, currently, we would like to try the combination of RBS and Steep to see if it will ...
0
votes
1
answer
37
views
How to create a hashtable using using values from 2 other hashtables in Powershell
Lets say I have 2 hashtables :
$table1 = @{"A" = "1";
"B" = "2";
"C" = "3"}
$table2 = @{"D" = "3";
...
3
votes
2
answers
102
views
Getting rid of repeated "Use of unititialized value $foo in pattern match" errors in big set of substitutions
I have a Perl script that builds a hash of symbols from C source files that are longer than X characters, then substitutes a string of A[0-9]{5}. The number increments with each successive symbol to ...