![]() |
|
[C#] Implementing a Dictionary-like structure for large sets? - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [C#] Implementing a Dictionary-like structure for large sets? (/showthread.php?tid=5451127) Pages: Pages
1
2
|
* - Mistermad - Nov 3, 2016 Why not make your own list? and create a new Add method so that you can check if the value you want to add is already in the list or not? The only problem I can see is that this will get slow once you have a few items. Code class NewList<T> : List<T>* - severos - Nov 3, 2016 (Nov 3, 2016 12:34 AM)Mistermad Wrote: Why not make your own list? Because I don't want access time O(n) structure, imagine that I have to check over 100million objects just to add one... and imagine the time I have to build the 100million objects at first place -think it's O(n^2)- * - Snoweyes - Nov 3, 2016 (Nov 2, 2016 09:24 PM)severos Wrote: Thanks for the suggestions, I'll look into them and hope to find a solution. I found this article which might help you: http://www.codeproject.com/Tips/837172/Creating-PartitionedDictionary Its what The-One mentioned, partitioning the dictionary. This StackOverflow answer explains why you get a memory out of range exception: http://stackoverflow.com/a/3657189 * - severos - Nov 3, 2016 (Nov 3, 2016 10:34 AM)Snoweyes Wrote: I found this article which might help you: http://www.codeproject.com/Tips/837172/Creating-PartitionedDictionary Thanks for the link, I'll read it soon. As for the out of memory exception, I tried running the diagnostic tools and it was reading 1GB of memory before throwing the exception, no idea why tho. * - Khamul - Nov 3, 2016 I guess you could implement a HashTable with linear probing? Could be good although deletion would be a problem. |