g**o 发帖数: 29 | 1 i was asked how to check a file with a column of numbers, and need to
check if there's duplicated entries.
i answerd to use std::set, but it seems very unsatisfying...
any better idea? |
t*****g 发帖数: 1275 | 2 sort | uniq -c
If you don't want to read everything into memory, sort the input first.
【在 g**o 的大作中提到】 : i was asked how to check a file with a column of numbers, and need to : check if there's duplicated entries. : i answerd to use std::set, but it seems very unsatisfying... : any better idea?
|
g**o 发帖数: 29 | 3 thanks! works perfectly, but i was asked to implement it in c++
【在 t*****g 的大作中提到】 : sort | uniq -c : If you don't want to read everything into memory, sort the input first.
|
t*****g 发帖数: 1275 | 4 that was what I meant..merge sort the input first and then stream in to the
application, if you want to avoid reading everything into memory
【在 g**o 的大作中提到】 : thanks! works perfectly, but i was asked to implement it in c++
|
g**o 发帖数: 29 | 5 good point
the
【在 t*****g 的大作中提到】 : that was what I meant..merge sort the input first and then stream in to the : application, if you want to avoid reading everything into memory
|
i***h 发帖数: 12655 | 6 看题目的意思, 好象是算法题, 不是应用题
hash table? |