tagged [hashtable]

Hash table runtime complexity (insert, search and delete)

Hash table runtime complexity (insert, search and delete) Why do I keep seeing different runtime complexities for these functions on a hash table? On wiki, search and delete are O(n) (I thought the po...

How do I use Hashtables/HashSets in .NET?

How do I use Hashtables/HashSets in .NET? I have a list of ~9000 products, and some of which may have duplicates. I wanted to make a HashTable of these products with the products serial number as thei...

Why can't you use null as a key for a Dictionary<bool?, string>?

Why can't you use null as a key for a Dictionary? Apparently, you cannot use a `null` for a key, even if your key is a nullable type. This code: ...results in this exception: > Value cannot be null. ...

1 Feb at 17:57

Cast a hashtable.Keys into List<int> or other IEnumerable<int>

Cast a hashtable.Keys into List or other IEnumerable I know, I have other options, e.g. I could maintain a separate list of keys. Please don't suggest other options. I simply want to know if I can pul...

8 Mar at 17:32

.NET HashTable Vs Dictionary - Can the Dictionary be as fast?

.NET HashTable Vs Dictionary - Can the Dictionary be as fast? I am trying to figure out when and why to use a Dictionary or a HashTable. I have done a bit of a search on here and have found people tal...

Best way to check if a key exists in a Dictionary before adding it?

Best way to check if a key exists in a Dictionary before adding it? When getting a key from a Dictionary you're not sure exists, you would usually use `TryGetValue` instead of `ContainsKey` + the get ...

What happens when a duplicate key is put into a HashMap?

What happens when a duplicate key is put into a HashMap? If I pass the same key multiple times to `HashMap`’s `put` method, what happens to the original value? And what if even the value repeats? I di...

9 Jan at 10:29

Building a sorted dictionary using ToDictionary

Building a sorted dictionary using ToDictionary I'm not an expert in C# and LINQ. I have a `Dictionary`, which I understand a hash table, that is, keys are not sorted. `Record` is a user-defined class...

3 Sep at 01:11

Need an efficient in-memory cache that can process 4k to 7k lookups or writes per second

Need an efficient in-memory cache that can process 4k to 7k lookups or writes per second I have an efficient C# application that receives 80 bytes of data at a rate of 5k to 10k records per second on ...

how does except method work in linq

how does except method work in linq I have the classes: ``` class SomeClass { public string Name{get;set;} public int SomeInt{get;set;} } class SomeComparison: IEqualityComparer { public bool Equa...

Hash table in JavaScript

Hash table in JavaScript I am using a hash table in JavaScript, and I want to show the values of the following in a hash table I have found the following code. It works for the following data. How do ...

20 Apr at 05:33

Hash table faster in C# than C++?

Hash table faster in C# than C++? Here's a curiosity I've been investigating. The .NET Dictionary class performs ridiculously fast compared to the STL unordered_map in a test I keep running, and I can...

21 Oct at 20:1