C++实现文本文件查重算法的问题
PHP中文网
PHP中文网 2017-04-17 13:02:18
0
1
783

新手
最近有一个题目,需要使用C++编写一个图形界面,实现两个>1k的文本文件(.txt)的查重,并将重复部分高亮显示。
现在已经实现了基本功能,使用QT,可以将A文件中的B文件中的句子高亮显示,但是有一个问题就是,B文件中只能是短语或者是单词,因为使用的是完全匹配算法,如果文章太长就不能找到。
现在想实现两篇文章输入,并显示出两篇文章的相同部分,请问使用什么算法?linux下的diff()函数类似。

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(1)
PHPzhong

(Currently no idea about the algorithm)

In line with the belief of not reinventing the wheel, I recommend using diff directly, or taking a look at the source code of diff

This is the information link from Baidu

(If you have any ideas, please add more, if not, I will give up_(:3)JL)_

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!