Find Unique Characters in a File

前端 未结 22 2746
耶瑟儿~
耶瑟儿~ 2021-02-04 03:30

I have a file with 450,000+ rows of entries. Each entry is about 7 characters in length. What I want to know is the unique characters of this file.

For instance, if my f

22条回答
  •  没有蜡笔的小新
    2021-02-04 04:25

    Algorithm: Slurp the file into memory.

    Create an array of unsigned ints, initialized to zero.
    
    Iterate though the in memory file, using each byte as a subscript into the array.
        increment that array element.
    
    Discard the in memory file
    
    Iterate the array of unsigned int
           if the count is not zero,
               display the character, and its corresponding count.
    

提交回复
热议问题