Uniqueness of lines in a large file

In C, I want to process a file containing 10 8 16-digit alphanumeric strings and determine if each of them is unique in the file. How can i do this?

+3
source share
5 answers

As other people have said, the easiest way is to simply download the entire file and use something like qsortto sort it.

If you cannot load so much information into memory at once, another option is to load data in several passes. On the first pass, read the file and download only the lines starting with A. Sort them and find unique strings. For the next pass, load all lines starting with B, sort and find unique lines. Repeat this process for each alphanumeric character the line can begin with. Using this technique, you will only need to load part of the file into memory at a time, and this should not cause any lines to be classified incorrectly.

+2
source

, ~ 16 , - ( - ) .

, C, (- ), .

+1

( ) , . , , .

+1

.

, qsort C , , , , .

0

Take a library with typing / display functions, for example. see link text

0
source

Source: https://habr.com/ru/post/1759599/


All Articles