I have a very large dataset ( integer data ) in file .
I would like to search for duplicates data (int value) and then remove them from file in a rapidly way.
What would be a good algorithm for this ??
I'm reading about minhash algorithm. Is it a good way for this purpose? or is there another way??

tu guPosted Jul 30, 2026, 2:43 AM
Duplicate detection is an interesting problem, especially when dealing with large datasets.
For integer data, using a HashSet is usually a good approach when the data can fit into memory because it provides fast lookup performance. For very large files, external sorting or streaming-based approaches can be more practical.
Similar techniques are also useful in document processing systems. For example, when analyzing large collections of resumes or documents, efficient data handling helps identify repeated information, extract useful content, and improve processing speed.
Modern AI tools such as ATS Checker also rely on efficient document analysis methods to process resumes, extract keywords, and evaluate content against job requirements.
Choosing the right algorithm usually depends on the size of the dataset, available memory, and whether real-time processing is required.
Sam HobbsPosted Jul 29, 2026, 9:10 PM
You have not specified whether there are values associated with the integers. If there are values then it is not clear what should be done with values for duplicate integers.
Probably you can use either the
HashSet class if there is no associated values or theDictionary class for data with associated values.HashSet Class (System.Collections.Generic) | Microsoft Learn
https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.hashset-1?view=net-10.0
Dictionary Class (System.Collections.Generic) | Microsoft Learn
https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.dictionary-2?view=net-10.0
Those collection classes will automatically sort the data for optimum retrieval during execution.
Bohdan StupakPosted Jul 28, 2026, 2:39 PM
Minhash is not the right fit as it is used to measure how two sets are similar.
You can tackle the problem in multiple ways depending on whether the dataset fits in memory. If it fits, you can build a Hashset of all possible values. In such a case, you can get the result in O(n) time.
If the file does not fit in memory, you can use external sort to sort its contents. It can be performed in O(n log n) time. After sorting is performed, you iterate all the items in O(n) time. Duplicate items will be neighbours, so you just need to check whether the item is equal to a preceding item, and if so, skip it as a duplicate.
There is room for optimisation if you know that integers are in a certain range. Let's say from 1 to 1 000 000. In such a case you can keep a bitmap of found integers. In such a case, you can perform duplicate check in O(n) time, and for 100 000 000 items, you'll need 12.5 Mb of memory