如何计算天真字符串搜索算法的计算和时间复杂度? [英] How do i calculate computational and time complexity of naive string search algorithm?

查看:126
本文介绍了如何计算天真字符串搜索算法的计算和时间复杂度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何计算天真字符串搜索算法的计算和时间复杂度?

How do I calculate computational and time complexity of naive string search algorithm?

推荐答案

与其他任何操作相同:

The same way you do for any other operation:
"You add up how many machine instructions it will execute as a function of the size of its input, and then simplify the expression to the largest (when N is very large) term and can include any simplifying constant factor."



资料来源:如何找到算法的时间复杂度 - Stack Overflow [ ^ ] - 它是关于我见过的最简洁的定义!

但基本上,它意味着正是ppolymorphe所说的:答案取决于实际代码。

关于如何解决问题的更详细说明:复杂性和大O符号 [ ^ ]

这不是什么我们可以为你做。


Source: How to find time complexity of an algorithm - Stack Overflow[^] - and it's about the most succinct definition I've seen!
But basically, it means exactly what ppolymorphe said: "The answer depend of actual code."
More detailed explanation as to how to work it out: Complexity and Big-O Notation[^]
This isn't something we can do for you.


这篇关于如何计算天真字符串搜索算法的计算和时间复杂度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆