algorithm - C# set of preknown integers as Dictionary custom key -


i want create dictionary conceptually dictionary<hashset<int>, foobar> hashset<int> in key has following restriction:

  1. the members can chosen 0 n

i think restriction, there should more performant way writing custom iequalitycomparer (as described in post c# list dictionary key). example, when n<64, each of such hash sets can mapped unique int64. list contains 1,3,18,29, (1 << 1) + (1 << 3) + (1 << 18) + (1 << 29)which 537133066 can represent combination, implement dictionary<int64, foobar> achieve goal. apparently approach doesn't scale beyond 64.

------11/11/2016 update------

thanks commented below. have better understanding on how hash works, , think trying create collision-free hash hashset<int> described unbounded n either impossible or hard , not worthwhile.

also found solution under question: how use hashset<t> dictionary key?. not sure how performance is, @ least easy implement.

better generate hash of values in list , use dictionary int or long key.


Comments

Popular posts from this blog

sql server - Cannot query correctly (MSSQL - PHP - JSON) -

php - trouble displaying mysqli database results in correct order -

C++ Linked List -