这个递归算法的重要特征是什么?(What is the big-O of this recursive algorithm)
我们有一个大小为n的问题
一种递归地求解大小为n-1的子问题并对解决方案执行线性工作量的算法。
我尝试使用plug n chug,发现big-O是n,线性,但这对我来说似乎不对。 我还能尝试什么?
We have a problem of size n
An algorithm that recursively solves a subproblem of size n − 1 and performs a linear amount of work on the solution.
I tried using plug n chug and found that the big-O is n, linear, but that does not seem right to me. What else could I try?
原文:https://stackoverflow.com/questions/35931649
最满意答案
我建议使用md5deep或sha1deep 。 在Linux上只需安装包
md5deep
(它包含在大多数Linux发行版中)。安装完成后,只需在整个磁盘上以递归模式运行它,并使用以下命令将磁盘上每个文件的校验和保存到文本文件中:
md5deep -r -l . > filelist.txt
如果你喜欢
sha1
优于md5
,请改用sha1deep
(它是同一个包的一部分)。获得文件后,只需使用sort对其进行
sort
(或在上一步中将其sort
为sort
):sort < filelist.txt > filelist_sorted.txt
现在,只需使用任何文本编辑器查看结果 - 您将快速查看所有重复项以及它们在磁盘上的位置。
如果您如此倾向,可以在Perl或Python中编写简单的脚本,以根据此文件列表删除重复项。
I would recommend using md5deep or sha1deep. On Linux simply install package
md5deep
(it is included in most Linux distributions).Once you have it installed, simply run it in recursive mode over your whole disk and save checksums for every file on your disk into text file using command like this:
md5deep -r -l . > filelist.txt
If you like
sha1
better thanmd5
, usesha1deep
instead (it is part of the same package).Once you have a file, simply sort it using
sort
(or pipe it intosort
in previous step):sort < filelist.txt > filelist_sorted.txt
Now, simply look at the result using any text editor - you will quickly see all the duplicates alongside with their locations on disk.
If you are so inclined, you can write simple script in Perl or Python to remove duplicates based on this file list.
相关问答
更多-
假设图像与模型相关,例如附有回形针的模型,则可以执行此操作。 (我真的推荐这个)。 def show @image = Image.find(params[:id]) published_image = @image.published_image respond_to do |format| format.all { if published_image send_file published_image.at ...
-
试试这种方式 HTML代码:
-
只从目录获取图像文件(Get only image files from directory)[2023-08-17]
// Store your supported image Extensions NSArray *extensionList = [NSArray arrayWithObjects:@"jpg", @"jpeg", @"png", @"gif", @"bmp", nil]; // Grab the content Directory NSArray *contents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:pathForC ... -
你应该把图像放在res / drawable文件夹中 You should put images in res/drawable folder
-
无法移动图像文件(Can not move image files)[2021-10-11]
在我添加了一些其他范围后,它可以工作。 var scopes = ['profile', 'https://www.googleapis.com/auth/drive','https://www.googleapis.com/auth/drive.file' , 'https://www.googleapis.com/auth/drive.metadata' , 'https://www.googleapis.com/auth/drive.appdata', 'https://www.goo ... -
我找到了解决方案。 事实上,两种可能的解决方案: 将javascript和CSS文件保存在单独的目录中,并创建“location”规则,仅对该目录使用gzip_static 如果这是不可能的(托管多个网站,而不是你控制的一切,太多的目录和文件)有一个更简单的解决方案,通过使用open_file_cache_errors设置来阻止多个open()调用,该设置缓存(即记住).gz文件不是目前并不会再尝试打开它。 I found a solution. In fact, two possible solution ...
-
JPanel panel = ... ... ... File yourFileHere = ... ... ... BufferedImage img = new BufferedImage(panel.getWidth(), panel.getHeight(), BufferedImage.TYPE_INT_ARGB); Graphics g = img.getGraphics(); panel.paint(g); g.dispose(); try{ ImageIO.write(img, "p ...
-
查找重复的图像文件(Finding Duplicate image files)[2023-09-24]
我建议使用md5deep或sha1deep 。 在Linux上只需安装包md5deep (它包含在大多数Linux发行版中)。 安装完成后,只需在整个磁盘上以递归模式运行它,并使用以下命令将磁盘上每个文件的校验和保存到文本文件中: md5deep -r -l . > filelist.txt 如果你喜欢sha1优于md5 ,请改用sha1deep (它是同一个包的一部分)。 获得文件后,只需使用sort对其进行sort (或在上一步中将其sort为sort ): sort < filelist.txt > ... -
引自这里 : 这会将图像添加到另一个: using (Graphics grfx = Graphics.FromImage(image)) { grfx.DrawImage(newImage, x, y) } Quoted from here: This will add an image to another: using (Graphics grfx = Graphics.FromImage(image)) { grfx.DrawImage(newImage, x, y) }
-
使用第三方组件:Aspose.Words,它可以为您完成。 Document doc = new Document(MyDir + "Document.doc"); doc.Save(MyDir + "Document.ConvertToHtml Out.html", SaveFormat.Html); 它还支持保存到Png格式。 SaveFormat.Png:呈现文档的页面并将其另存为PNG文件。 use a third party component: Aspose.Words, it can do ...