I want to have a dictionary that assigns a value to an integer.
For example, key is [1 2 3] , and value will have a specific value.
The fact is that [3 2 1] needs to be handled the same way in my case, so the hash should be equal if I go with the hash approach.
The set will contain from 2 to 10 elements.
The sum of the elements is usually fixed, so we cannot make a hash code according to the sum, which is the first natural idea here.
Not a homework job that really runs into this problem in my code.
This set is basically an IEnumerable<int> in C #, so any data structure stores them perfectly.
Any help appreciated. Performance is also important here.
Immediate thought: we could summarize items^2 and already get some better hash, but still I would like to hear some thoughts.
EDIT: hmm, sorry guys, they all offer to order, it never occurred to me that I need to say that in fact ordering and hashing is the current solution that I am using and I am considering faster alternatives.
source share